Hi all!
I have two same-sized black on white images (image1.png image2.png). I would like to merge these images in such a way that the locations where both images are black are turned to white in the composite image.
I tried making some commands using compose and multiply, but I didn't have much luck. I think there was something very wrong with my commands...I am very new to image processing and could use some advice on this. Thanks!
image multiplication?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: image multiplication?
You might compose them. See http://www.imagemagick.org/Usage/compose/
What result do you want when one or other isn't black? I mean, just setting the result to white, no matter what, would satisfy your requirement!
What result do you want when one or other isn't black? I mean, just setting the result to white, no matter what, would satisfy your requirement!
snibgo's IM pages: im.snibgo.com
Re: image multiplication?
That's a good question, obviously I didn't explain well b/c I did not think this out thoroughly.
More precisely:
I would like to remove (turn white) from image1.png any places where image 1.png and image2.png have overlapping black pixels. All the rest of image1.png I want to leave the same.
More precisely:
I would like to remove (turn white) from image1.png any places where image 1.png and image2.png have overlapping black pixels. All the rest of image1.png I want to leave the same.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: image multiplication?
Okay. You want the output to be input #1, except that where both inputs are black, you want white. This will do it, but there may be a better way. Windows BAT syntax:
Code: Select all
convert ^
g1.png ^
( +clone ^
g2.png ^
-negate ^
-compose Multiply -composite ^
-alpha set +transparent White ^
) ^
-compose Over -composite ^
out.png
snibgo's IM pages: im.snibgo.com
Re: image multiplication?
that works, thanks!