Page 1 of 1

Getting png from pdf with the minimum size

Posted: 2011-07-18T03:22:43-07:00
by Pablito
I try to get png file from pdf file but the size of output png is still very large for my task. I try everything (I'm the beginner):

convert -density 94 -background none -compress Zip +contrast +contrast +contrast +contrast +contrast +contrast +contrast -quality 100 -define png:bit-depth=1 -define png:compression-filter=4 -define png:compression-level=9 -define png:exclude-chunk=none,gama -define png:compression-strategy=4 -define png:extent=10kb -define png:size=800x1086 -gravity center -antialias -auto-gamma -auto-level -auto-orient -clamp -colors 130 -interpolate integer -colorspace sRGB -depth 2 -crop 800x905-40-40 -trim A1_.pdf[0] A1-1.png

Can I get smaller png documents without essential loss of quality?

Re: Getting png from pdf with the minimum size

Posted: 2011-07-18T06:54:12-07:00
by glennrp
By "size" are you referring to the dimensions of the image or the
compressed filesize?

There is no -define PNG:size=WxH so that's ignored. Just
use -resize WxH instead. -quality 100 is out
of the valid range, so use 90 instead.

-define png:compression-strategy=4 selects Z_FIXED compression
which I believe is uncompressed! I don't know what -define png:extent=10kb
is supposed to do.

I think your best approach is to eliminate all of the -define png:* except for
the "exclude-chunks" one. You don't need the -compress Zip directive
when writing a PNG file.

You might get a better-looking output if you use a larger -density (the -resize
option will reduce the image dimensions to whatever you specify)