LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   (imagemagick)why this command can not compress png image... (https://www.linuxquestions.org/questions/linux-software-2/imagemagick-why-this-command-can-not-compress-png-image-855783/)

kingliang123 01-12-2011 04:28 AM

(imagemagick)why this command can not compress png image...
 
in imagemagick,
i have a png format picture, but it seems too big for me,
i wanna compress it ...
how can i do ...
command line...

Code:

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 bigger...

MensaWater 01-12-2011 06:34 AM

png files are ALREADY compressed. Compressing a file that is already compressed will often cause what you saw - the file actually grows in size.

qrange 01-12-2011 10:28 AM

png is loss-less format so 'quality' setting has no meaning. what you need is jpg.

arizonagroovejet 01-12-2011 03:44 PM

Quote:

Originally Posted by qrange (Post 4221790)
what you need is jpg.

I'd say that depends on the nature of the image. Large blocks of colour in a png tend not to stay that way after conversion to jpg. You are probably right though if their complaint is that the filesize is too large.

Perhaps if the OP were to attach or provide a link to the png in question someone could advise better.

I looked in to png filesize a few months ago when I found myself wanting to use png for some images because I needed them to have transparent sections but the filesizes where larger than I would have liked. (Several times larger than the transparency lacking jpg version of the image.) I came to the conclusion that there is often little you can do to reduce their filesize and if you can it might be very slow. There are tools and methods that will sometimes help though I don't recall finding anything in ImageMagick for it.

E.g. http://davidwalsh.name/pngcrush

Putting 'reduce png file size' will of course yield other suggestions.

The ImageMagick folks have their own forum at http://www.imagemagick.org/discourse...e547ab12e3bb69 so might be worth asking there.

kingliang123 01-12-2011 08:45 PM

thanks all...
i find that, png format is hard to compress...
the size after i use optipng to compress,
just reduce 3k...


All times are GMT -5. The time now is 04:40 AM.