Imagick PHP - Optimizing PNG gotchas...
mar., janvier 26, 2010 at 18:29 I think this deserves to be shared:
If you are generating PNG images using the Imagick extension, you might notice that your PNG files might end up beeing very very big.
I don't know exactly why, but it all RGB channels defaults to 8 bits for some reason, even if you set the image depth to 8.
So here is the solution to gain 66% of your PNG.
Just before sending the img to the client, do:
$img->setImageDepth(8);
$img->setImageChannelDepth(imagick::CHANNEL_RED, 4);
$img->setImageChannelDepth(imagick::CHANNEL_GREEN, 4);
$img->setImageChannelDepth(imagick::CHANNEL_BLUE, 4);
imagick,
optimize,
php,
png in
php & mysql 