如何使用imagick for php(imagemagick)设置像素的颜色? [英] How to set color of a pixel using imagick for php (imagemagick)?
问题描述
我使用getImagePixelColor在特定点获取图像的图像像素。
I have get the image pixel of an image at the particular point using getImagePixelColor.
$pixel = $image -> getImagePixelColor($x,$y);
现在我已经使用某种方法修改了该像素的颜色,现在我想设置它的新颜色像素。
Now I have modified that pixel's color using some method and now I want to set the new color of that pixel.
我该怎么办?
有一个setColor函数。但我得到了Imagick类的像素。但是setColor函数在ImagickPixel类中。那我该怎么办呢?
There is a setColor function. But I got the pixel from the Imagick class. But the setColor function is in the ImagickPixel class. So how can I do it ?
推荐答案
- > getImagePixelColor()
无论如何都返回一个ImagickPixel对象,所以 $ pixel-> setColor(...);
就是你所需要的:
->getImagePixelColor()
returns an ImagickPixel object anyways, so $pixel->setColor(...);
is all you need:
参考: http://php.net/manual/en/imagick.getimagepixelcolor。 php
这篇关于如何使用imagick for php(imagemagick)设置像素的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!