using fx to add a constant to each rgb pixel
Posted: 2013-12-12T08:27:13-07:00
Hi,
I'm looking for a way to add a constant value to each of the rgb pixel of an image. I'm currently using the fxImage function in php.
The reason I want to do this is am trying to change the brightness of the image similar to how my html5 javscript library does it.
I can do what I want using
I tried using something like
the image is as expected (plain yellow box )
I tried using "rgb(r/255,g/255, b/255)" or "rgb(r*255,g*255, b*255)" but I still get a black box.
Is my understanding correct that it seems you can't use the r,g,b values inside the rgb() function of the fx operator?
Any help would be appreciated , thank you.
I'm looking for a way to add a constant value to each of the rgb pixel of an image. I'm currently using the fxImage function in php.
The reason I want to do this is am trying to change the brightness of the image similar to how my html5 javscript library does it.
I can do what I want using
- $img = $img->fxImage("r+0.5",Imagick::CHANNEL_RED);
$img = $img->fxImage("g+0.5",Imagick::CHANNEL_GREEN);
$img = $img->fxImage("b+0.5",Imagick::CHANNEL_BLUE);
I tried using something like
- $img = $img->fxImage("rgb(r+0.5,g+0.5, b+0.5)");
- $img = $img->fxImage("rgb(255,255, 0)")
the image is as expected (plain yellow box )
I tried using "rgb(r/255,g/255, b/255)" or "rgb(r*255,g*255, b*255)" but I still get a black box.
Is my understanding correct that it seems you can't use the r,g,b values inside the rgb() function of the fx operator?
Any help would be appreciated , thank you.