-compose Dst_Out img.png mask.png not working anymore?

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?".
Post Reply
chaoscarnage
Posts: 57
Joined: 2012-12-31T15:56:29-07:00
Authentication code: 6789

-compose Dst_Out img.png mask.png not working anymore?

Post by chaoscarnage » 2017-08-27T13:15:00-07:00

I used to use -compose Dst_Out img.png mask.png to apply some masks where the white part is kept and the black part is cut off but now it appears that it keeps whats in the black part and cuts out whats in the white. Tried changing it to -compose Dst_In img.png mask.png but had no luck. Is there a way to tell it to do it the old way?

User avatar
fmw42
Posts: 22079
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: -compose Dst_Out img.png mask.png not working anymore?

Post by fmw42 » 2017-08-27T13:37:37-07:00

Please always provide your IM version and platform and provide your full command line and if possible your input and output images. That way we can test with the corresponding version of IM and your command and images.

Your syntax may be wrong. Read your input images before -compose xxx -composite, if using the convert .... compose xxx -composite syntax, which is more flexible than composite. Your comments are confusing since you do not give the full command line.

See
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/basics/#why

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620

For novices, see

viewtopic.php?f=1&t=9620
http://http://www.imagemagick.org/scrip ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/

chaoscarnage
Posts: 57
Joined: 2012-12-31T15:56:29-07:00
Authentication code: 6789

Re: -compose Dst_Out img.png mask.png not working anymore?

Post by chaoscarnage » 2017-08-27T15:59:05-07:00

Version: ImageMagick 7.0.5-7 Q16 x86_64 2017-05-25 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP
Delegates (built-in): png zlib

convert blank.png \( -compose Dst_Out red.png mask1.png -composite \) -compose Over -composite \( -compose Dst_Out blue.png mask2.png -composite \) -compose Over -composite out.png

album of images here http://imgur.com/a/Ds3nu

What I want to happen is for the white part to be kept and the black parts to be cut away. Right now it seems to do nothing. Sorry for my poor explination earlier.

User avatar
fmw42
Posts: 22079
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: -compose Dst_Out img.png mask.png not working anymore?

Post by fmw42 » 2017-08-27T17:04:53-07:00

Your syntax is not correct as I explained above. For IM 7 you should be using magick not convert. IM 7 is not forgiving as IM 6 with syntax errors. Your command does not work for me even in IM 6. Do you have an example of a good result from IM 6 that you made before.

Right now I am not sure what result you want, so I do not know how to fix the issue. Are you sure you used dst_out before and it worked?

My guess as what you want is:

IM 6

Code: Select all

convert blank.png \
\( red.png \( mask1.png -alpha copy \) -compose Dst_In -composite \) \
-compose Over -composite \
\( blue.png \( mask2.png -alpha copy \) -compose Dst_In -composite \) \
-compose Over -composite red_blue_mask_im6.png
Image

IM 7

Code: Select all

magick blank.png \
\( red.png \( mask1.png -alpha copy \) -compose Dst_In -composite \) \
-compose Over -composite \
\( blue.png \( mask2.png -alpha copy \) -compose Dst_In -composite \) \
-compose Over -composite red_blue_mask_im6.png
Image

You need Dst_In and your masks need to copy the image to the alpha channel.

If this is not correct, then please provide a correct output example.

chaoscarnage
Posts: 57
Joined: 2012-12-31T15:56:29-07:00
Authentication code: 6789

Re: -compose Dst_Out img.png mask.png not working anymore?

Post by chaoscarnage » 2017-08-27T17:42:46-07:00

Thank you for your help and time. Thats exactly what I needed it to do. Oddly enough thats the result i get when using ImageMagick 6.9.1-10 Q16 x86_64 2015-07-29 with the code I posted.

User avatar
fmw42
Posts: 22079
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: -compose Dst_Out img.png mask.png not working anymore?

Post by fmw42 » 2017-08-27T17:46:25-07:00

Your original code produces a totally transparent image for me with IM 6.9.9.9 Q16 Mac OSX. Are you sure you did not have masks with alpha channels, or different images or a different command?

snibgo
Posts: 9378
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: -compose Dst_Out img.png mask.png not working anymore?

Post by snibgo » 2017-08-27T18:53:25-07:00

I don't know what you want, but perhaps "src_out" gives it.

Where did your command come from? Did you build it up in stages? Has the behaviour really changed, or has the command changed?

EDIT: "totally" transparent is the expected result. This is what I get, on v6.9.5-3
snibgo's IM pages: im.snibgo.com

Post Reply