当我使用 php gd 库裁剪 png 图像时,它以一种奇怪的方式裁剪。因为它被部分裁剪。我认为透明度无法正常工作。
这是我的代码
imagesavealpha($this->image, true); $bg = imagecolorallocatealpha($this->image, 0, 0, 0, 127); imagefill($this->image, 0, 0, $bg); imagepng($this->image,$filename);
当我使用 php gd 库裁剪 png 图像时,它以一种奇怪的方式裁剪。因为它被部分裁剪。我认为透明度无法正常工作。
这是我的代码
imagesavealpha($this->image, true); $bg = imagecolorallocatealpha($this->image, 0, 0, 0, 127); imagefill($this->image, 0, 0, $bg); imagepng($this->image,$filename);
听起来您好像给新图像提供了错误的尺寸。
你如何裁剪图像?imagecopyresampled
?
http://php.net/manual/en/function.imagecopyresampled.php