How do I shift the hue of a black png?
Posted: 2018-11-14T14:05:10-07:00
hello friends!
Imagick newbie here...
having difficulty accomplishing something simple: load a black png and shift its color before outputting to screen.
platform: OSX Mojave
returns
etc.
my PHP:
throws an error
changing code to this
throws same error.
i'm not married to the colorizeimage() function... simply want to shift the hue
btw: code works fine displaying the image on the screen if i remove the colorizeImage line. so there's apparently no problem with Imagick install.
Imagick newbie here...
having difficulty accomplishing something simple: load a black png and shift its color before outputting to screen.
platform: OSX Mojave
Code: Select all
php --ri imagick
Code: Select all
imagick module => enabled
imagick module version => 3.4.3
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 7.0.8-14 Q16 x86_64 2018-10-25 https://imagemagick.org
Imagick using ImageMagick library version => ImageMagick 7.0.8-14 Q16 x86_64 2018-10-25 https://imagemagick.org
my PHP:
Code: Select all
$dir = dirname(__FILE__);
$imageFolder = "/images/";
$faceImageFile = "face.png";
$face = new Imagick();
$face->readImage($dir . $imageFolder . $faceImageFile);
$face->colorizeImage('rgba(255, 0, 0, 0)', 1.0);
$face->writeImage();
header('Content-type: image/png');
echo $face;
Code: Select all
Unrecognized color string in /Users/bolyro/Sites/crestia/setColorValue.php:12 Stack trace: #0 /Users/bolyro/Sites/crestia/setColorValue.php(12): Imagick->colorizeimage('rgba(255, 0, 0,...', 1) #1 {main} thrown in...
Code: Select all
$face->colorizeImage('#AA0000', 1.0);
i'm not married to the colorizeimage() function... simply want to shift the hue
btw: code works fine displaying the image on the screen if i remove the colorizeImage line. so there's apparently no problem with Imagick install.