我在网站上上传图像并将图像更改为适合 100 x 100 白色正方形的缩略图。问题是图像看起来没有正确抗锯齿。在 Photoshop 中缩小尺寸的图像看起来很平滑,但这些看起来很脆,就像超级锐化一样。
看看这些样本,左侧显示全尺寸,右侧显示缩略图(100% 视图)。这张照片看起来非常锐利,但很多人可能不会被它打扰。虽然这幅画是不可接受的。那些曲线根本不抗锯齿,变成虚线。
我使用 imagejpg(),我选择的 jpg 质量对松脆度没有影响。继承人一些围绕它的代码:
$tmp_img = imagecreatetruecolor( $maxSize, $maxSize );
$white = ImageColorAllocate ($tmp_img, 255, 255, 255);
ImageFill($tmp_img, 0, 0, $white);
imagecopyresized( $tmp_img, $img, $offsetx, $offsety, 0, 0, $new_width, $new_height, $width, $height );
$thumbFullPath = "{$pathToThumbs}/{$filenameNoExtension}.jpg";
imagejpeg( $tmp_img, $thumbFullPath, 90 );
有任何想法吗?这是正常的吗?谢谢!