Getting png from pdf with the minimum size

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Pablito
Posts: 5
Joined: 2011-07-18T03:15:45-07:00
Authentication code: 8675308

Getting png from pdf with the minimum size

Post 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?
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Getting png from pdf with the minimum size

Post 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)
Post Reply