create a new "layer" the same size as the original with clone and fill black

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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

create a new "layer" the same size as the original with clone and fill black

Post by Bonzo »

I have seen this done but I can not remember how to do it. To create a mask with with a canvas the same size as the original something like:

Code: Select all

convert input +clone -background black -fill white -draw "roundRectangle 50,0 200,300 10,10" -composite output
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: create a new "layer" the same size as the original with clone and fill black

Post by fmw42 »

clones must be enclosed in parenthesis. I am not sure what your command is trying to do. Can you explain what you want to do in a bit more detail. What kind of mask do you want? If some solid color, then

\( +clone -fill somecolor -colorize 100% \)
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: create a new "layer" the same size as the original with clone and fill black

Post by Bonzo »

That is what I was looking for thank you fmw42. It is just the start of something I am trying out:

Code: Select all

convert input -resize x300 ( +clone -fill white -colorize 100% -fill black -draw "roundRectangle 50,0 200,300 10,10" ) -composite output
I was looking to create a mask to isolate an area in the middle of an image.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: create a new "layer" the same size as the original with clone and fill black

Post by snibgo »

As Fred says, however, "-colorize" takes numbers that are already percentages. The syntax doesn't require a % percent sign. See http://www.imagemagick.org/script/comma ... p#colorize
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: create a new "layer" the same size as the original with clone and fill black

Post by Bonzo »

Yes as you say snibgo using -colorize 100 works as well
Post Reply