what's using of "-mask filename" in convert?

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
haibara
Posts: 10
Joined: 2008-05-06T02:30:15-07:00

what's using of "-mask filename" in convert?

Post by haibara »

i found its explanation - Composite the image pixels as defined by the mask.

what's the meaning? filter a image according to a specified mask?

regards
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: what's using of "-mask filename" in convert?

Post by fmw42 »

haibara wrote:i found its explanation - Composite the image pixels as defined by the mask.

what's the meaning? filter a image according to a specified mask?

regards

see http://www.imagemagick.org/Usage/compose/#compose

it allows the mask to control where two images are composited over each other or using other -compose settings
haibara
Posts: 10
Joined: 2008-05-06T02:30:15-07:00

Re: what's using of "-mask filename" in convert?

Post by haibara »

fmw42 wrote:
see http://www.imagemagick.org/Usage/compose/#compose

it allows the mask to control where two images are composited over each other or using other -compose settings
does cmd like this?
convert [overlay] [background] -mask [mask] [result]
i find strange result, only get [overlay] and [background] in [result] name again, [mask] seems no effect

how to create a specified color image whose size as a specified image?
convert [source] -fill [#rgb hex] -draw 'color 0,0 reset' [result] donesn't work, why?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: what's using of "-mask filename" in convert?

Post by fmw42 »

haibara wrote:
fmw42 wrote:
see http://www.imagemagick.org/Usage/compose/#compose

it allows the mask to control where two images are composited over each other or using other -compose settings
does cmd like this?
convert [overlay] [background] -mask [mask] [result]
i find strange result, only get [overlay] and [background] in [result] name again, [mask] seems no effect

how to create a specified color image whose size as a specified image?
convert [source] -fill [#rgb hex] -draw 'color 0,0 reset' [result] donesn't work, why?

I am not familiar with -mask. To composite with a mask the command syntax is:

convert backgroundimage overlayimage maskimage -compose somecomposemethod -composite resultimage

see -compose methods at http://www.imagemagick.org/Usage/compose/

To create an image of a specific size and color:

convert -size WidthxHeight xc:"color" resultimage

where Width and Height are the size of the resultimage and "color" can be any colorname or color defined in RGB or Hex. see http://imagemagick.org/script/color.php
haibara
Posts: 10
Joined: 2008-05-06T02:30:15-07:00

Re: what's using of "-mask filename" in convert?

Post by haibara »

fmw42 wrote:

I am not familiar with -mask. To composite with a mask the command syntax is:

convert backgroundimage overlayimage maskimage -compose somecomposemethod -composite resultimage

see -compose methods at http://www.imagemagick.org/Usage/compose/

To create an image of a specific size and color:

convert -size WidthxHeight xc:"color" resultimage

where Width and Height are the size of the resultimage and "color" can be any colorname or color defined in RGB or Hex. see http://imagemagick.org/script/color.php
in fact, i always use convert [background] [overlay] [mask] -compose [result]
when i find -mask, i only want to know what's this. via some tests, i still can't understand its effect, so i post.


about 2nd queston,
i want to create a specified color image whose size as a specified image. here i don't know image size, new image size comes from a specified image

now i find convert [source] -fill [rgb] -colorize 100% [result] can work

other resolution?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: what's using of "-mask filename" in convert?

Post by anthony »

The better idea is to look at the actual masked examples at

http://www.imagemagick.org/Usage/compose/#mask

You do NOT use -mask which is a clipping mask not a composition mask.

Actually I have not figured out using -mask as yet :-)
However I do believe it defines a limiting region in which changes can occur.
It may also be restricted to being a simple boolean mask. I have not experimented enough to know for certain.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply