I'm trying to colorize specific regions of an image based on a mask using ImageMagick. The mask contains white pixels where the image should be colorized and black pixels where no colorization should occur.
magick convert input_image.png mask.png -alpha off -compose CopyOpacity -composite -fill "#FF5733" -colorize 100% output_image.png
Here is one way to do that in Imagemagick. Create a colorized image the size of the input. Then use the mask to composite them together.
(Don't use magick convert --- use just magick)
Image:
Mask:
magick lena.png ( +clone -fill blue -colorize 100 ) mask.png -compose over -composite lena_colorized.png