imagepng() quality
bloxcms opened this issue · 4 comments
Replace
imagepng($this->image, null, round(9 * $quality / 100));
by
imagepng($this->image, null, round(9*(1-$quality/100)));
The third param in imagepng()
is not quality but compression 0-9
You're right, that parameter doesn't make much sense for PNG images. Even if "quality" somehow correlated to compression, it's currently reversed.
I'm voting to remove quality from PNG and use the default zlib compression value (same as omitting the $quality
argument). This will affect the size of PNG images, but I don't consider it a breaking change since PNG is a lossless format.
Any thoughts or objections to this?
TODO
- Remove "quality" argument from
imagepng
- Update docs to state that quality only affects JPEG images since GIF and PNG are lossless formats
No plans to use Imagick, as ImageMagick is not installed by default on most systems and is often a pain point for those who try to install it (especially on shared hosting environments).
As far as I'm aware, there's no explicit limit to the size of an image GD will process. This is usually limited by available memory. See this post for more info and a possible solution.