Page 1 of 1

Blendmode "screen" on transparent canvas

Posted: 2019-05-14T00:30:13-07:00
by higoka
I need to compose three images together.
The problem is image b_4_0.png is opaque and has transparency (semi-transparent). The black pixels should not be there.

Code: Select all

magick -size 300x300 canvas:transparent \
  img/a_4_0.png -geometry +114+55 -compose over -composite \
  img/b_4_0.png -geometry +109+75 -compose screen -composite \
  img/c_4_0.png -geometry +118+119 -compose over -composite \
  result.png
Result:
Image

What it should look like:
Image

Code: Select all

magick identify -format '%[opaque]' img/a_4_0.png # false
magick identify -format '%[opaque]' img/b_4_0.png # true
magick identify -format '%[opaque]' img/c_4_0.png # false
The image b_4_0.png is opaque, sure it has to do something with this or the min max mean values

Images: img.zip

Re: Blendmode "screen" on transparent canvas

Posted: 2019-05-14T02:08:27-07:00
by snibgo
"screen" affect alpha in the same was as "over" affects alpha: where a source pixel is opaque, the result is opaque.

If you don't want this, your can extract the alpha to mpr, then "CopyOpacity" after the "screen".

Re: Blendmode "screen" on transparent canvas

Posted: 2019-05-14T05:34:35-07:00
by higoka
can you give me an example

Re: Blendmode "screen" on transparent canvas

Posted: 2019-05-14T06:24:50-07:00
by snibgo

Code: Select all

magick -size 300x300 canvas:transparent \
  a_4_0.png -geometry +114+55 -compose over -composite \
  \( +clone -alpha extract +write mpr:ALP +delete \) \
  b_4_0.png -geometry +109+75 -compose screen -composite \
  mpr:ALP -alpha off -geometry +0+0 -compose CopyOpacity -composite \
  c_4_0.png -geometry +118+119 -compose over -composite \
  result.png