Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
higoka
Posts: 17 Joined: 2019-04-22T16:36:51-07:00
Authentication code: 1152
Post
by higoka » 2019-05-14T00:30:13-07:00
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:
What it should look like:
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
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2019-05-14T02:08:27-07:00
"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".
higoka
Posts: 17 Joined: 2019-04-22T16:36:51-07:00
Authentication code: 1152
Post
by higoka » 2019-05-14T05:34:35-07:00
can you give me an example
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2019-05-14T06:24:50-07:00
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