So, I have a situtation with ImageMagick and php, where I need to process each of the RGB channels separately, and then combine them back into the final image. So, in the code below, $ red, $ green and $ blue are channels (like grayscale images). The following code is what I tried (and several options), but every time I finish an image that shows only cyan, magenta, or yellow. In this case, the resulting image is Cyan.
$im->removeImage(); $im->addImage($red); $im->addImage($green); $im->addImage($blue); $img = $im->combineImages(self::CHANNEL_ALL); $im->removeImage(); $im->removeImage(); $im->removeImage(); $im->addImage($img);
I think part of my problem is that the PHP documentation does not say how to use combImages and there are no samples as far as I can find. Therefore, it is very likely that I am using this method incorrectly, and I suspect that it is related to the way I combine images in one Imagick object to start with.
EDIT
This question ultimately boils down to the following: how do I recreate the following script using only php?
convert tmp_r.png tmp_g.png tmp_b.png -combine tmp_rgb.png
source share