I've been combining two images with a straight blend, so that the final image is some percent of the overlay and the background. Like so:
composite -blend 25 overlay.jpg background.jpg destination.jpg
Now I'd like to do the same thing, but in screen or multiply mode. I thought it would be a simple matter of replacing -blend with -screen, but apparently it isn't that simple.
All I want to do is replicate a GIMP layering, where two layers are combined in screen mode, and the layer on top is only visible or weighted at 25%.
I know this should be pretty easy, but it escapes me, any help is appreciated.
Thanks
composite -compose screen @some % of overlay image?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: composite -compose screen @some % of overlay image?
-blend is a specialised composition that weights the two images before adding (plus) them together.
http://www.imagemagick.org/Usage/compose/#blend
-dissolve is very similar but performs an over composition.
http://www.imagemagick.org/Usage/compose/#dissolve
To do this with screen or multiply does not make sense. mathematically a weighted multiple (or for screen negated multiply) is just a same as doing the multiply of the images and a constant!
An alternative to blend is to use the special 'mathematic' compostion
http://www.imagemagick.org/Usage/compose/#mathematics
EG; using convert options...
and
should produce the same results.
WARNING: mathematics uses 'screen' alpha blending when alpha channels are present, just like the other mathematical composition methods. Blend however uses 'blend' alpha blending.
See Mathematical Composition and Alpha Blending
http://www.imagemagick.org/Usage/compose/#math_blending
ASIDE: looks like their is a bug in mathematical blending without the 'sync' channel flag. -- I have noted it, to have a look.
http://www.imagemagick.org/Usage/compose/#blend
-dissolve is very similar but performs an over composition.
http://www.imagemagick.org/Usage/compose/#dissolve
To do this with screen or multiply does not make sense. mathematically a weighted multiple (or for screen negated multiply) is just a same as doing the multiply of the images and a constant!
An alternative to blend is to use the special 'mathematic' compostion
http://www.imagemagick.org/Usage/compose/#mathematics
EG; using convert options...
Code: Select all
-compose blend -define compose:args=25x75 -composite
Code: Select all
-compose mathematics -define compose:args=0,0.25,0.75,0 -composite
WARNING: mathematics uses 'screen' alpha blending when alpha channels are present, just like the other mathematical composition methods. Blend however uses 'blend' alpha blending.
See Mathematical Composition and Alpha Blending
http://www.imagemagick.org/Usage/compose/#math_blending
ASIDE: looks like their is a bug in mathematical blending without the 'sync' channel flag. -- I have noted it, to have a look.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: composite -compose screen @some % of overlay image?
thanks, but maybe we talking at cross purposes? I'm not sure if I understand what you are suggesting. I'm ok with the blend mode for where I need to use that. What I need to do now is combine two images in screen mode. A background image with a starfield, and black silhouetted foreground, and an overlay image with the foreground illuminated showing detail. I want to combine the two images using screen, so that where the background image is purely black, about 25% of the overlay image foreground detail shows through. In Gimp, I make the foreground image 25% opaque, and use screen mode. I need to do this with several hundred images, each time I make a scene, so I'd like to do it in imagemagick. I'm rather dense when it comes to figuring out the command line options through, for example, in your examples, I'm not sure where the input image designations go, and I don't think those commands give me a screen mode?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: composite -compose screen @some % of overlay image?
Sounds like a masked composition to me.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: composite -compose screen @some % of overlay image?
Try this.
convert BOTTOM_IMAGE ( TOP_IMAGE -alpha Set -channel A -evaluate Multiply 0.25 +channel ) -compose Screen -composite OUT.JPG
s.
convert BOTTOM_IMAGE ( TOP_IMAGE -alpha Set -channel A -evaluate Multiply 0.25 +channel ) -compose Screen -composite OUT.JPG
s.
Re: composite -compose screen @some % of overlay image?
Stupid isn't so stupidstupid wrote:Try this.
convert BOTTOM_IMAGE ( TOP_IMAGE -alpha Set -channel A -evaluate Multiply 0.25 +channel ) -compose Screen -composite OUT.JPG
s.

My terminal doesn't like the parenthesis, but without them it seems to work. It doesn't exactly replicate the GIMP version, but I think that I can work with it.
thanks a lot. I couldn't make these images without imagemagick.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: composite -compose screen @some % of overlay image?
Without the parenthesis, you are applying the alpha channel dissolve to BOTH images, not just one image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: composite -compose screen @some % of overlay image?
It's worth noting that the parentheses require spaces on both sides of each character. Eg SPACE(SPACE... SPACE)SPACE. You could also try escaping the parentheses: \(... \). On Windows that would be ^(... ^).
s.
s.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: composite -compose screen @some % of overlay image?
windows does not need escaping for parenthesis
http://www.imagemagick.org/Usage/windows/#dos
http://www.imagemagick.org/Usage/windows/#dos
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/