繁体   English   中英

在pdf上插入png后不透明的背景

[英]Not transparent background after inserting png on pdf

我正在尝试在Ubuntu Server上使用Imagick在pdf文件上添加png图像。

$background = imagecolorallocate($signature_place, 255, 255, 255);
imagefill($signature_place, 0, 0 , $background);
imagecolortransparent($signature_place, $background);

但是背景为白色。

Ubuntu服务器上的示例

有趣的事实是它可以在Windows上正常工作。

Windows上的示例

我正在使用:

  • php7.0-fpm
  • php-imagick 3.4.3

我真的不明白错误可能在哪里。

有人遇到这样的问题吗? 我在哪里可以找到错误?

这就是我使用的PNG

    $im = imagecreatefrompng($this->source);
    imagealphablending($newImg, false);
    imagesavealpha($newImg, true);
    $transparent = imagecolorallocatealpha($newImg, 255, 255, 255, 127);
    imagefilledrectangle($newImg, 0, 0, $newWidth, $newHeight, $transparent);
    imagecopyresampled($newImg, $im, 0, 0, 0, 0, $newWidth, $newHeight, $this->srcWidth, $this->srcHeight);
    imagepng($newImg, $this->destin);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM