官方博客
官方博客

如何在Imagick中设置图像像素颜色?

i am using Imagick for image processing. I am unable to find any native function to set a particular pixel color while there is one to get one. I mean,

$image->getimagepixelcolor($i, $j);

will return an object to get the color of pixel at ($i, $j) but there doesn't seems to be a method to set color. Something like this,

$image->setimagepixelcolor($i, $j, "#FFFFFF");


以下是将图像从RGB转换为CMYK的基本步骤

$image = new Imagick();
$image->readImage(rgb.jpg);
$image->setImageColorSpace(Imagick::COLORSPACE_CMYK);
$image->profileImage('icc', file_get_contents(/path/CoatedFOGRA27.icc'));
$image->negateImage(FALSE, imagick::COLOR_CYAN);
$image->negateImage(FALSE, imagick::COLOR_MAGENTA);
$image->negateImage(FALSE, imagick::COLOR_YELLOW);
$image->negateImage(FALSE, imagick::COLOR_BLACK);
$image->writeImage(cmyk.rgb);

2020-05-10 12:46:49
0 热度