Why does “convert x.png y.png” creates an image with a different size (KB)?

PNGs have many different settings affecting the compression, and there's no guarantee that the default ImageMagick settings choose a particular efficient compression.

PNGs have many different settings affecting the compression, and there's no guarantee that the default ImageMagick settings choose a particular efficient compression. The easiest solution is to run your PNG through OptiPNG after ImageMagick is done with them. By default, it should generate something close to the best possible compression, but you can ask it to do a more exhaustive testing to get to an absolute minimum.

Regarding your edit: One thing you have to be aware of here is the resize method. ImageMagick will use a filter during the resize, and that can have a big impact on how much you can compress the image with PNG: after all, PNG is lossless compression, so it can't just approximate it like JPEG. Which filters will work for you really depends on what sort of image you have, but you can try various options and see what looks nice.

You might need different filters for different images.

Thanks for the suggestion! Please see my edit for the question. – AmitA Sep 28 '10 at 19:59 Thanks, i'll also look at the filter option, perhaps this is the issue.

– AmitA Sep 28 '10 at 21:58 Could you help me out with this question (stackoverflow. Com/questions/5818603/…)? I find it odd that GD can reduce the size of PNG images, but Imagick can't.

– Alix Axel May 7 at 4:08 @Alix: I don't really know that much about ImageMagick, just a few bits and pieces. I don't see anything I can contribute to that question other than what has already been said in the answers. – Michael Madsen May 7 at 13:06.

Probably ImageMagick just doesn't have optimal compression or the input is a palette image and ImageMagick creates a RGB image. In the former case you could run pngcrush on the downscaled images to reduce size.

Thanks for the suggestion! Please see my edit for the question. – AmitA Sep 28 '10 at 19:59 Can you upload the original and downscaled image somewhere?

– fschmitt Sep 28 '10 at 20:17 Sure, I provided a link to them in the edit above. – AmitA Sep 28 '10 at 22:00.

Ok, the issue was with the filters per Michael's suggestion. Here is what I did: convert -list filter > 1. Txt to get a list of all filters.

Then, for every x which is a filter on that list, I did: convert -filter x -resize 234x1419 a. Png b_x. Png I recorded the file size, and then did "optipng -o7" on each file.

The best filter for this image for my case was "Box": it was the only one that actually got reduced from 112KB to 111KB, and then to 81KB by optipng. I think it is interesting to note that after all this process, only the Box filter actually got the size of the image reduced, even though all of them have less pixels after the resize process. BTW: watch out for the following trap convert -filter Box -resize 234x1419 a.

Png a_box. Png results in an image of 112KB which can be compressed to 81KB, as I said above. However: convert a.

Png -filter Box -resize 234x1419 a_box. Png results in an image of 199KB!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions