Page 1 of 1

Dst_Out and layers

Posted: 2015-12-21T15:53:01-07:00
by excel
There are two images:

extrude.png (with opacity) and rect.png (without opacity)

Image Image

Code: Select all

composite -compose Dst_Out -alpha Set extrude.png rect.png result.png
This command allows to get such result.png (with opacity):

Image


How to get result with a green inner frame?

Image

Re: Dst_Out and layers

Posted: 2015-12-21T16:21:21-07:00
by fmw42
try this as one way to do it.

(unix syntax)

Code: Select all

convert rect.png \
\( -clone 0 -fill green1 -colorize 100% \) \
\( extrude.png -alpha extract -auto-level -write show: \) \
-compose over -composite \
-fuzz 30% \
-fill none -draw "matte 2,2 floodfill" \
-rotate 90 -fill none -draw "matte 2,2 floodfill" \
-rotate 90 -fill none -draw "matte 2,2 floodfill" \
-rotate 90 -fill none -draw "matte 2,2 floodfill" \
-rotate 90 result.png
Please always provide your IM version and platform, since syntax differs on Unix and Windows.

Re: Dst_Out and layers

Posted: 2015-12-21T17:28:32-07:00
by excel
fmw42 wrote:try this as one way to do it.

(unix syntax)

Code: Select all

convert rect.png \
\( -clone 0 -fill green1 -colorize 100% \) \
\( extrude.png -alpha extract -auto-level -write show: \) \
-compose over -composite \
-fuzz 30% \
-fill none -draw "matte 2,2 floodfill" \
-rotate 90 -fill none -draw "matte 2,2 floodfill" \
-rotate 90 -fill none -draw "matte 2,2 floodfill" \
-rotate 90 -fill none -draw "matte 2,2 floodfill" \
-rotate 90 result.png
Please always provide your IM version and platform, since syntax differs on Unix and Windows.


Debian 7,
Version: ImageMagick 6.8.9-9 Q16 x86_64 2015-01-05

Thanks, your example works, but why the corners are dirty?
Which parameter allows avoid this?


Image

Re: Dst_Out and layers

Posted: 2015-12-21T17:51:18-07:00
by fmw42
try increasing the -fuzz value. This happens because your transparent image has black on the line and black in the corners. So I had to make all black into green and then make the corners transparent by fuzzy floodfill.

Code: Select all

convert rect.png \
\( -clone 0 -fill green1 -colorize 100% \) \
\( extrude.png -alpha extract -auto-level \) \
-compose over -composite \
-fuzz 60% \
-fill none -draw "matte 2,2 floodfill" \
-rotate 90 -fill none -draw "matte 2,2 floodfill" \
-rotate 90 -fill none -draw "matte 2,2 floodfill" \
-rotate 90 -fill none -draw "matte 2,2 floodfill" \
-rotate 90 result.png


Or perhaps better to separate the extrude.png alpha channel into two different images: one for the line and the other for the corner.

Code: Select all

convert rect.png \
\( -clone 0 -fill green1 -colorize 100% \) \
\( extrude.png -alpha extract -auto-level \) \
\( -clone 2 -fuzz 60% -fill black \
-rotate 90 -draw "color 2,2 floodfill" \
-rotate 90 -draw "color 2,2 floodfill" \
-rotate 90 -draw "color 2,2 floodfill" \
-rotate 90 -draw "color 2,2 floodfill" \) \
\( -clone 2 -clone 3 -compose difference -composite -negate \) \
-delete 2 \
\( -clone 0-2 -compose over -composite  \) \
-delete 0-2 +swap \
-alpha off -compose copy_opacity -composite \
result.png


Re: Dst_Out and layers

Posted: 2015-12-22T07:53:39-07:00
by excel
Thank you.
I decided to split "extrude.png" into two files.
Then easier to operate and good quality.