How to disable sub-sampling when saving jpg image using PHP GD library?

允我心安 提交于 2021-01-29 18:52:39

问题


I noticed that each time I save a jpg file in PHP, it is saved with sub-sampling. How to remove that? I'm using GD library.


回答1:


I believe newer versions of libgd disable chroma-subsampling if you set the quality to 90 or higher.

Failing that, you could consider using PHP Imagick and disabling chroma sub-sampling with:

$img->setSamplingFactors(array('1x1', '1x1', '1x1'));


来源:https://stackoverflow.com/questions/57350007/how-to-disable-sub-sampling-when-saving-jpg-image-using-php-gd-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!