6

I am using imagemagick to overlay one image over another with a blending option. I'd like to adjust the overlaying image opacity to about 60%. I would only like to adjust the foreground image, not the merged group. I Currently have:

exec("convert $img_in test_images/test_opacity.jpg -compose screen -composite $img_out");

And I'd like something like this:

exec("convert $img_in (test_images/test_opacity.jpg -opacity 0.6) -compose screen -composite $img_out");

Any help here would be much appreciated.

Chris
  • 833
  • 2
  • 17
  • 37

1 Answers1

6

Use the +level, or -level-color options to adjust the white/black points. This will generally give the mask the effects of "dodging" or "burning"; which, compose Screen will respect.

convert source.jpg \
        \( mask.jpg -normalize +level 0,60% \) \
        -compose screen -composite destination.jpg

You can also adjust the opacity of the mask by defining an alpha channel with -alpha, -channel & -evaluate. See this question. But this wouldn't work with compose Screen as it's expecting a range between black & white.

convert source.jpg \
        \( mask.jpg -alpha set -channel A -evaluate set 60% \) \
        -compose screen -composite \
        destination.jpg
Community
  • 1
  • 1
emcconville
  • 23,800
  • 4
  • 50
  • 66
  • For me, the 2nd command worked better without the -compose screen param. It would not be opaque at 100% and rather do some weird multiply thingy – user1666456 Jun 03 '16 at 11:07