PHP GD 라이브러리, JPG PNG 손실 압축 비율

2021-01-23 작성 2023-01-07 수정

PHP GD 라이브러리를 이용하여 JPG(JPEG)와 PNG 형식의 이미지를 변환할 때 출력 이미지의 퀄리티는 다음과 같이 조정합니다.

imagejpeg

0 (최저 퀄리티, 최소 용량) - 100 (최고 퀄리티, 최대 용량).
기본값은 약 75

imagepng

0 (무압축, no compression) - 9.
기본값 zlib compression

imagegif

퀄리티 조정 불가

imagewbmp

퀄리티 조정 불가

GD Graphics Library

https://libgd.github.io

PHP: GD - Manual

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

참고

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

유용한 PHP 솔루션
https://www.ppcle.com/blog/php-scripts/

PHP 절대경로, 상대경로 파악하기
https://www.ppcle.com/blog/php-realpath/