문제

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.

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top