Bernhard Seefeld was testing the new compression option for imagepng and was wondering why there is still a relative big difference in image sizes.
In my first attempt to create smaller images, I only allowed to change the compression, it was not sufficient to get really lite pictures.
After a short look to the libpng codebase (and the horrible imagick doc), I added a last argument to imagepng, the filtering mode. Here are the results, sorted by size (a.png is the source image):
<br />
18650 a.png<br />
<br />
18556 none.png<br />
18556 all.png<br />
24536 sub.png<br />
28727 up.png<br />
29095 paeth.png<br />
32788 default.png<br />
36658 avg.png<br />
I used this little script, if you like to test it:
<br />
<?php<br />
$im = imagecreatefrompng(“a.png”);<br />
imagesavealpha($im,true);<br />
imagepng($im, “default.png”, 9);<br />
imagepng($im, “none.png”, 9, PNG_NO_FILTER);<br />
imagepng($im, “sub.png”, 9, PNG_FILTER_SUB);<br />
imagepng($im, “up.png”, 9, PNG_FILTER_UP);<br />
imagepng($im, “avg.png”, 9, PNG_FILTER_AVG);<br />
imagepng($im, “paeth.png”, 9, PNG_FILTER_PAETH);<br />
imagepng($im, “all.png”, 9, PNG_ALL_FILTER);<br />
?><br />
I save the alpha channel as the source image has a transparent “background”, but it is not really relevant here 
The option will be present from PHP 5.1.3 (or whatever will be the next 5.x release) have fun while saving your bandwidth 