How to efficiently compress PNG? In my case, the images are small grayscale images with transparency.
I am currently playing with this:
// ... $im->setImageFormat('png'); $im->setImageColorspace(\Imagick::COLORSPACE_GRAY); $im->setImageCompression(\Imagick::COMPRESSION_LZW); $im->setImageCompressionQuality(9); $im->stripImage(); $im->writeImage($url_t);
Since Imagick does not offer COMPRESSION_PNG
, I tried LZW, but there are almost no changes in file size (usually it is even bigger than before).
If I open the image in GIMP and just save it, the file size will be significantly reduced (for example, 11.341 B → 3.763 B or 11.057 B → 3.538).
What is the correct way to save compressed PNG using Imagick?
source share