Reputation: 13492
I'm converting .jpg and .gif images to .png
using PHP's Imagick library.
I've successfully converted these images to .png using this:
$image = new Imagick( $file_path );
$image->setImageFormat( 'png' );
$image->writeImage( $file_path );
However, I have been unable to compress the .pngs or control their final size at all. I've tried using the following line before $image->setImageFormat()
and a few other variations with no success:
$img->setImageCompressionQuality( 95 );
If .png
compression with Imagick is lacking, then what other utilities should I use to compress these files?
This manual may help.
Upvotes: 3
Views: 2780
Reputation: 13492
I installed OptiPNG and it works fine.
After a lengthy battle, I was unable to get IMagick to compress png's properly.
Upvotes: 5