hankcoder has asked for the wisdom of the Perl Monks concerning the following question:
I need suggestion on which is the best available module/method to compress PNG file with transparent/alpha support.
I tried with ImageMagick, it works great on JPG but when deal with PNG, I can't make the file size smaller. Tried all kinds of method.
I also tried with using PHP imagecreatefrompng, imagepng but it screw up the transparent on output.
The only best I tested is using pngquant (command line). But it is only on my Windows IIS ActivePerl environment. I'm not sure how to install/setup pngquant on my linux hosting server. It is too complicated to me.
So I seek for alternative method in perl which I'm more familiar with.
Any help are very much appreciated. Thanks.
* UPDATE *
ImageMagick using
$image->Resize(geometry => "${width}x${height}");
able to resize the PNG (with transparent). Without transparent resize also ok but file size still not small compare to pngquant.
I still need a PNG compression without resizing dimension.
* UPDATE *
This only able to reduce png file size from 1,666kb to 1,228kb without resize dimension.
$image->Set(quality =>'95'); $image->Set(depth=>'8');
* UPDATE *
After done more test with imagemagick, the best it only able to reduce about 20%. My current final best test still on pngquant where from 1666kb to 377kb. That is Huge difference.
pngquant command used pngquant --quality 20-40 -speed 11 [png file]
* FINAL UPDATE *
I have decided to use pngquant and managed to get it installed on linux.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: PNG compression support transparent
by wjw (Priest) on Jul 23, 2015 at 07:09 UTC | |
|
Re: PNG compression support transparent
by tangent (Parson) on Jul 23, 2015 at 17:15 UTC | |
by hankcoder (Scribe) on Jul 24, 2015 at 07:03 UTC | |
|
Re: PNG compression support transparent
by Anonymous Monk on Jul 23, 2015 at 16:30 UTC | |
by hankcoder (Scribe) on Jul 24, 2015 at 07:05 UTC |