ppcle Blog

PHP GD library, JPEG PNG lossy compression ratio.

4 months ago 134

When converting images in JPG (JPEG) and PNG formats using the PHP GD library, the quality of the output image is adjusted as follows:

imagejpeg

0 (lowest quality, smallest size) - 100 (highest quality, largest size).
The default is about 75.

imagepng

0 (no compression) - 9.
Default zlib compression

imagegif

Quality adjustment is not available

imagewbmp

Quality adjustment is not available

GD Graphics Library

https://libgd.github.io

PHP: GD - Manual

https://www.php.net/manual/en/book.image.php

References

PHP: Hypertext Preprocessor
https://www.php.net

Understanding PHP Absolute and Relative Paths
https://www.ppcle.com/post/php-realpath/