简体   繁体   English

无法使用Imagick更改图像不透明度

[英]Unable to change the Image Opacity by using Imagick

I want to change the opacity of images in php. 我想在php中更改图像的不透明度。 I used Imagick and it is working fine for creating thumbnails, converting images etc, but not working for SetImageOpacity method. 我使用了Imagick,它可以很好地创建缩略图,转换图像等,但不适用于SetImageOpacity方法。

My code is: 我的代码是:

<?php
$image = 'a.png';
$im = new Imagick($image);
$im->pingImage($image);
$im->readImage( $image );
$im->setImageOpacity( 0.3 );
$im->writeImage( 'changed.png' );
?>

But it is not working. 但它没有用。 Can anyone please tell me the reason my code is not working? 任何人都可以告诉我我的代码不工作的原因? I searched for the code and every where i got the same code. 我搜索了代码和每个我得到相同代码的地方。 So, what is the problem please help....... 那么,有什么问题请帮忙.......

http://php.net/manual/en/function.imagick-setimageopacity.php This method is available if Imagick has been compiled against ImageMagick version 6.3.1 or newer. http://php.net/manual/en/function.imagick-setimageopacity.php如果Imagick是针对ImageMagick版本6.3.1或更新版本编译的,则此方法可用。

So you will need recompile your imagemagic version to newer 因此,您需要将imagemagic版本重新编译为更新版本

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

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