【发布时间】:2020-02-02 01:59:26
【问题描述】:
如果我重新采样透明 WEBP 图像,则背景颜色为黑色。这些方法对 PNG 有帮助,但不适用于 WEBP。
示例:
$thumb = imagecreatetruecolor($newWidth, $newHeight);
imagecolortransparent($thumb, imagecolorallocate($thumb, 0, 0, 0));
imagecopyresampled($thumb, $image, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
【问题讨论】: