[SOLVED] Combining multiple masks/colors to generate image
Posted: 2008-01-17T07:06:17-07:00
Hi,
In a web-based app I'm developing, I need to recolor some images, using the customer specified colors. My take on this was, that the designers will create a series of masks and I'll paint them with the respective color and combine the results. The masks will be the same size, so I don't have to worry about how to combine them. I also wanted to do that without generating intermediate images on the disk, because I'll have to clean-up afterwards.
The problem is, that I can't understand how to combine the commands.
For single mask, I do this:
For two masks, this:
However, this doesn't work for three masks:
Please, help me.
Cheers,
Ivan
P.S. The application is written in C++ and I'd rather have it call an external shell script to do the work, than to link it to IM.
In a web-based app I'm developing, I need to recolor some images, using the customer specified colors. My take on this was, that the designers will create a series of masks and I'll paint them with the respective color and combine the results. The masks will be the same size, so I don't have to worry about how to combine them. I also wanted to do that without generating intermediate images on the disk, because I'll have to clean-up afterwards.
The problem is, that I can't understand how to combine the commands.
For single mask, I do this:
Code: Select all
convert -size {WxH} \
\( xc:{color1} {mask1} +matte -compose Copy_Opacity -composite \) \
{result}
Code: Select all
convert -size {WxH} \
\( xc:{color1} {mask1} +matte -compose Copy_Opacity -composite \) \
\( xc:{color2} {mask2} +matte -compose Copy_Opacity -composite \) \
-compose Src_Over -composite \
{result}
Code: Select all
convert -size {WxH} \
\( xc:{color1} {mask1} +matte -compose Copy_Opacity -composite \) \
\( xc:{color2} {mask2} +matte -compose Copy_Opacity -composite \) \
\( xc:{color3} {mask3} +matte -compose Copy_Opacity -composite \) \
-compose Src_Over -composite \
{result}
Cheers,
Ivan
P.S. The application is written in C++ and I'd rather have it call an external shell script to do the work, than to link it to IM.