gpt4 book ai didi

PHP imagecreatefromjpeg 和 imagecopy 在图像上创建像素化和非常差的质量

转载 作者:行者123 更新时间:2023-12-02 15:35:31 24 4
gpt4 key购买 nike

使用此代码后(仅处理图像的部分)

$image = imagecreatefromjpeg($filename);
$new_width = $thumbnail_width;
$new_height = $thumbnail_height;
$start_width = 0;
$start_height = 0;
$start_width = ($thumbnail_width - $image_params[0]) / 2;
$start_height = ($thumbnail_height - $image_params[1]) / 2;
imagecopy($image_res, $image, $start_width, $start_height, 0, 0, $image_params[0], $image_params[1]);

我得到的像素化结果非常非常差,你可以在这里看到 enter image description here

这是原图

enter image description here

PHP 版本 5.3.18

捆绑了 GD 版本(兼容 2.0.34)

使用 GD 对我来说是必须的。这个例子在许多服务器上运行良好,但在一些服务器上我得到了这个糟糕的结果,我想知道原因。

有什么帮助吗?

最佳答案

我在指定质量百分比时解决了同样的问题。

imagejpeg($im, 'watemark.jpg', 100);

或 75 等。

http://php.net/manual/en/function.imagejpeg.php

关于PHP imagecreatefromjpeg 和 imagecopy 在图像上创建像素化和非常差的质量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18249482/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com