Does this library support writing jpg files with only 1 or 2 channels to a pdf? #132
-
I am writing a simple file conversion program where I have a bunch of images in a folder and turn those into a pdf at some point, I just made a function to enable converting the images to greyscale only, and while the file size of the images is a lot lower, the pdf only shrinks a couple kb in size on a 42mb pdf. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
The JPEG images basically get copied in unchanged, since PDF supports JPEG decoding natively. So you should see a file size reduction. Can you send me an example of the problem (ie: the jpeg files etc...)? |
Beta Was this translation helpful? Give feedback.
-
Those numbers don't seem too surprising to me - the greyscale version is only 9kB smaller (7%). The final PDF is ~6% smaller. So that roughly tracks. The surprising thing is that making the jpeg greyscale in the first place didn't save much space. Using the images you sent through, I was able to get slightly better compression (16%) using ImageMagick - how are you converting them from colour -> grayscale? I used: The initial size of the image you sent was 130750, your grayscale one was 121602 (7% reduction), imagemagick's grayscale one is 110109 (16% reduction). |
Beta Was this translation helpful? Give feedback.
-
Thanks. I'm glad you're getting some use out of it. Good luck with the jpeg compression stuff. |
Beta Was this translation helpful? Give feedback.
The JPEG images basically get copied in unchanged, since PDF supports JPEG decoding natively. So you should see a file size reduction. Can you send me an example of the problem (ie: the jpeg files etc...)?