在 php 中使用 shearImage 函数时透明变黑

Transparent become black when using shearImage function in php

我正在尝试使用 php Imagick 来扭曲图像,就像这样

$image->shearImage("transparent", 0, $y);

下例中有四张图片,其中两张是倾斜的

在我的笔记本电脑上执行时,WSL Ubuntu 16.04、php7.4 会成功地扭曲图像并且背景是透明的。像这样

但是在digitalOcean中做同样的事情Ubuntu 18.04, php 7.4, 就变黑了这样

为什么会这样,有没有人遇到同样的问题?你是如何修复它的?

尝试使用:

Imagick::setImageVirtualPixelMethod — Sets the image virtual pixel method

setImageVirtualPixelMethod

基本上它指定了变换期间背景发生的情况