Page 1 of 1

TIFF to PDF with compression

Posted: 2013-04-18T18:26:51-07:00
by crazychris
I have a folder full of very large TIFF files (between 30MB and 350MB each) that need to be converted into a PDF file. I can easily use convert to create it, but the size becomes an issue very quickly. I can convert the TIFF files to JPEGs and convert them into a PDF and save 80% of the size which still maintaining the 100% scale and 100% quality. However I am wanting a single-line method rather than a multi-stage one as this is a batched process to run through lots of folders, and due to the size of the files, it takes an eternity to run too.

My current method is to introduce some compression on the TIFF files

Code: Select all

convert -limit memory 0 -limit map 0 *.tif -compress zip -quality 100 out.pdf
But this is still way larger than using intemedary JPG files and making the PDF from them.

So, is there a way I can compress multiple TIFF files (not a multipage TIFF) into a PDF and achieve good (or great) compression, without loss of size or quality, without having to do a convert to JPEG in-between?

Using ImageMagick .6.78 Q16 windows in portable install mode.

Re: TIFF to PDF with compression

Posted: 2013-04-18T18:55:57-07:00
by snibgo
If you find jpeg compression work for you, you might use that instead of zip. This also means you can use "-quality" for very small PDF sizes.

Code: Select all

convert ... -quality 40 -compress jpeg out.pdf

Re: TIFF to PDF with compression

Posted: 2013-04-18T19:27:27-07:00
by crazychris
Bingo!

I needed to retain 100% quality (no compression) but I wasn't aware of the jpeg compression option! Altered to:

Code: Select all

convert -limit memory 0 -limit map 0 *.tif -compress jpeg -quality 100 out.pdf
and the resulting file is now way smaller!

v1: TIFF -> PDF = 2.1GB
v2: TIFF -> zip compression -> PDF = 652MB
v3: TIFF -> jpeg compression -> PDF = 526MB

Doesn't quite meet the 482MB version that Acrobat produces, but I have a suspicion they added just a wee bit of compression in there!

Re: TIFF to PDF with compression

Posted: 2013-04-18T19:38:45-07:00
by snibgo
crazychris wrote:I needed to retain 100% quality (no compression) ...
Sadly, jpeg compression is always lossy, even at quality "100". If you don't want to lose any data, don't use jpeg.

EDIT: although, having said that, I see that "convert -list compress" includes "losslessjpeg". You might experiment with that, and other methods.