Page 1 of 1
why this command can not compress png image...
Posted: 2011-01-11T23:33:01-07:00
by kingliang123
i have a png format picture, but it seems too big for me,
i wanna compress it ...
how can i do ...
command line...
Code: Select all
convert "png.png" -strip -units PixelsPerInch -density 96 -quality 60 "png2.png"
this command can't compress the picture, the worse is: the size will be greater...
(99k)
Re: why this command can not compress png image...
Posted: 2011-01-12T10:52:15-07:00
by fmw42
if you are on Q16 IM, try adding -depth 8 to your command. IM is not good at optimizing PNG, but your PNG quality is not set right. See
http://www.imagemagick.org/Usage/formats/#png_quality. Also IM is not really good at optimizing PNG so you should try one of the third party optimizers. see
http://www.imagemagick.org/Usage/formats/#png_non-im
Re: why this command can not compress png image...
Posted: 2011-01-12T19:43:28-07:00
by kingliang123
thanks...
but, png format is hard to compress...
the size after i use optipng to compress,
just reduce 3k...
Re: why this command can not compress png image...
Posted: 2011-01-12T20:29:45-07:00
by fmw42
Did you try adding -depth 8?
Re: why this command can not compress png image...
Posted: 2011-01-12T20:30:34-07:00
by fmw42
Perhaps you would be better using GIF with fewer colors! That should be smaller. But gif only supports binary transparency, so the outline will not be as smooth.
I don't think IM supports 8-bit pseudocolor gif with 8-bit transparency (only binary transparency). So your png image will be 32-bits (8 bits each for R,G,B,A). That is why it is so big and why PNG or GIF may be smaller file size with reduced colors and binary transparency.
See
http://www.imagemagick.org/Usage/formats/#png_formats
convert 20585352_12948139006z63.png -colors 256 PNG8:20585352_12948139006z63_b.png
gives a file size of 36Kbytes, but the outline is not as clean.