masking operations

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

masking operations

Post by GreenKoopa »

I can limit the area affected by the -composite operation using a mask: http://www.imagemagick.org/Usage/compose/#mask Can this be done for other operations? I have been looking with no luck so I'm guessing not.

I want to modify a small part of a larger image, say using -blur or -fx. Right now I'm operating over an entire cloned copy and compositing the two using the mask. This is slow and complex, but admittedly workable. Even worse is modifications such as -auto-level or -contrast-stretch where operating over the entire image yields different results. (I also notice that -auto-level considers fully transparent pixels.)

Just a thought from a beginning user. Mostly ImageMagick is working out splendidly.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: masking operations

Post by fmw42 »

I think you are doing as best as IM can handle it right now as far as I know. But you might explore -region at http://www.imagemagick.org/script/comma ... php#region. But I have never used it before and it may be limited to a rectangular area.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: masking operations

Post by anthony »

region is one method but works by extracting a rectangular area, and then giving that to the later "mogrify" type non-sequence image operations.

however there is no simple way of specifying when to 'finish' with the region.

See Working with regions (its actually not just for distorts, and probably should move to 'misc')
http://www.imagemagick.org/Usage/warping/#region



Another is to set a 'clip mask' which is essentially exactly what a three image compose does!!!!

See options -mask -clip -clip-mask -clip-path

I have not done a lot of experiments with these, as such have no documentation on them (yet)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply