PNG compression using PHP magickwand

I am wondering how to properly compress a PNG image.

The situation is as follows:

I have a PNG image compressed and reduced using Irfanview on Windows. This is about 20 KB. When my portal software resizes (using magickwand 1.0.7), it with default values ​​is around 63K (!).

The next attempt was to call MagickSetImageDepth ($ this β†’ _ imageHandler, 8), resulting in a file size of 34K, which is better, but still it is larger than the original file (larger).

None of the documented features seem to be suitable for further image compression.

Any hints would be greatly appreciated!

Greetz, Sosa

+5
source share
2 answers

PNG compression programs and programs use different methods. I found that many times an image that has already been compressed (or efficiently saved) cannot be further compressed or even has a higher file size, as you experience.

In your case, I would say that your images cannot be compressed further, at least with MagickWand. You can simply refuse this step.

Optionally, optimizing your PNGs before launch will be the solution. In this case, there are many options. I got lucky with PNGGauntlet . You can run the batch job in PNGGauntlet and skip the files that it would make large, if any.

+1
source

Try this tool from Yahoo - it's great!

http://developer.yahoo.com/yslow/smushit/

0
source

All Articles