Page 1 of 1

TIF -> PDF file size grows after annotate

Posted: 2009-01-01T12:11:47-07:00
by moby11
When I do a simple convert (using 6.4.8 for Windows) from a small tif file to pdf, the file is roughly the same size. When I include any code to annotate, however, the file grows to 2x - 15x the original file size (depending on the source file).

Code: Select all

convert logo: logo.tif
results in a 45KB file.

Code: Select all

convert logo.tif logo.pdf
results in a 46KB file

Code: Select all

convert logo.tif -gravity north -pointsize 10 -fill black -annotate 0 "TEST" logo_annotate.pdf
results in a 75KB file

The file sizes of one of the tif files I'm using goes from 43KB original tif to a 574KB PDF when I use annotate, but only 46KB without.

Interesting clue, even if the text in the annotate is empty " ", it results in the larger file size even though the resulting image is exactly the same as no annotate.

I've tried tif -> ps -> pdf along with various options of compress, flatten, colors, etc. all to no avail.

Any help would be greatly appreciated.

Re: TIF -> PDF file size grows after annotate

Posted: 2009-01-01T12:56:05-07:00
by magick
You can reduce the image size by converting your truecolor image to colormapped by adding -colors 256 to your command line or by compressing the results. Try -compress zip or -compress RLE.

Re: TIF -> PDF file size grows after annotate

Posted: 2009-01-01T14:52:59-07:00
by moby11
Thanks for the quick response. That helps quite a bit using the logo image, but still results in files nearly double in size than the original on my actual scanned tif images (44KB to 82KB or 271KB to 567KB). This is a huge improvement over what I had originally found, but I still think there is something that could be done considering this increase occurs even if the text used in annotate is just empty space (" "). If I remove the annotate function, the conversion results in a size much more comparable to the original.

Any other ideas?

Re: TIF -> PDF file size grows after annotate

Posted: 2009-01-01T14:58:15-07:00
by magick
You could try -compress jpeg. If that does not work, you could try a solution other than ImageMagick.

Re: TIF -> PDF file size grows after annotate

Posted: 2009-01-01T15:25:50-07:00
by el_supremo
The original version had 231 unique colours and was stored as a palette type of image. The annotated image has 258 unique colours which pushed it over the limit for a palette-based image and so it was saved as truecolor. You can force a palette image by adding:

Code: Select all

-type palette
after the annotate.

Pete