why this command can not compress png image...

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
kingliang123
Posts: 8
Joined: 2011-01-11T23:27:29-07:00
Authentication code: 8675308

why this command can not compress png image...

Post 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... :cry:
Image
(99k)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: why this command can not compress png image...

Post 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
kingliang123
Posts: 8
Joined: 2011-01-11T23:27:29-07:00
Authentication code: 8675308

Re: why this command can not compress png image...

Post by kingliang123 »

fmw42 wrote: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
thanks...
but, png format is hard to compress...
the size after i use optipng to compress,
just reduce 3k...
:?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: why this command can not compress png image...

Post by fmw42 »

Did you try adding -depth 8?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: why this command can not compress png image...

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