I tried two different ways of getting what I expect to be the same output, the first is:
C = A * mask;
output = C + B;
or in nearer IM syntax
composite -compose multiply mask A C
composite -compose plus C B output
and the second is
convert B A mask -compose plus -composite output
which should give B + A * mask, which is the same as above. However the images produced (while similar) are different. compare -metric rmsd gives 807.5 (0.012), or if I view the images in sequence in a slide show there is a clear difference.
masked compose plus vs compose multiply, then plus
masked compose plus vs compose multiply, then plus
Last edited by hwttdz on 2011-04-19T13:09:44-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: masked compose plus vs compose multiply, then plus
hwttdz wrote:I tried two different ways of getting what I expect to be the same output, the first is:
C = A * mask;
output = C + B;
or in nearer IM syntax
composite -compose multiply mask A C
composite -compose plus C B output
and the second is
compose B A mask -compose plus -composite
which should give B + A * mask, which is the same as above. However the images produced (while similar) are different. compare -metric rmsd gives 807.5 (0.012), or if I view the images in sequence in a slide show there is a clear difference.
I believe your syntax (composite -compose multiply mask A C) is flawed. see http://www.imagemagick.org/Usage/compose/#compose
composite {overlay} {background} [{mask}] [-compose {method}] {result}
Personally, I prefer to use convert ... -compose ... -composite , since you can do all steps in one command.
Re: masked compose plus vs compose multiply, then plus
Sorry, I'm actually using convert -compose -composite (as suggested) and mangled it up in my attempt to post a minimum working example. So the ordering is correct. I'll try to update in original post.
I've switched to ppm from jpg and my error has gone down from 807.5 (0.012) to 667.7 (0.010). The difference between these two images is still very visible however.
Extending the above suggestion of using convert -compose -composite and combining commands (and using ppm for intermediate steps) I have continued to reduce the error. There is now no visibly apparent difference between the images. Thanks.
I've switched to ppm from jpg and my error has gone down from 807.5 (0.012) to 667.7 (0.010). The difference between these two images is still very visible however.
Extending the above suggestion of using convert -compose -composite and combining commands (and using ppm for intermediate steps) I have continued to reduce the error. There is now no visibly apparent difference between the images. Thanks.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: masked compose plus vs compose multiply, then plus
best to post your actual commands in a new reply rather than change what you have above or the other replies will confuse people
You can edit your original post and put a link to see the correction below
You can edit your original post and put a link to see the correction below