David Vanderson on wrote...
| Anthony Thyssen wrote:
| > David Vanderson on wrote...
| > | Hello,
| > |
| > | A few weeks ago we were doing cloud composition, which is close to
| > | something that I've been doing - setting the alpha channel of each pixel
| > | to the intensity of each pixel. Anthony asked why we were using -fx,
| > | which is slow, instead of -evaluate.
| > |
| > | I confess that I've tried and failed a few times to figure out how to do
| > | this with -evaluate. Can anyone enlighten me?
| > |
| > | Thanks,
| > | Dave
| >
| > Note -channel A -fx intensity
| > was being used to mapp a greyscale to the alpha channel.
| >
| >
| > Try this instead.
| >
| > convert image.png -colorspace gray \
| > -background white -channel A -combine ouptut.png
| >
| This does exactly what I want. Thank you very much.
|
There are three main whys of converting a greyscale mask into a
shaped mask of a specific color...
Combine with automatic background coloring of unused channels
convert mask.png -negate \
-background Red -channel A -combine red_shape.png
That is the simplist and fastest we have come across.
Turn off the channel setting if planing to continue processing.
The other one I used to recomend, takes an extra step.
Compose with CopyOpacity, and color with Colorise.
convert mask.png \
\( +clone \) +matte -compose CopyOpacity -composite \
-fill Gold -colorize 100% gold_shape.png
That works best when setting colors from some other image.
Or Compose with CopyOpacity with flatten to background color
convert mask.png \
+matte -background HotPink -compose CopyOpacity -flatten \
hotpink_shape.png
The only difference between "-flatten" and "-composite" is an extra
image and offseting using "-page" (virtual canvas, no gravity) or
"-geometry" (gravity effected). We could also have used the new
"-layers composite" (multiple image lists, with both page offset (no
gravity) + geometry (with gravity) at the same time.)
The last method involves using a three image masked compose
and that can take 3 steps...
convert mask.png \( +clone -channel A -evaluate set 0 +channel \)
+swap \( +clone \) -composite \
-fill Orange -colorize 100% orange_shape.png
That method works best when using the mask to select between two
separate images.
All these shaping methods are listed in
IM Examples, Channels and Masking, Masks as Colored Shapes
http://www.imagemagick.org/Usage/channels/#shapes
Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
Scotty: I beamed the whole kit and kaboodle over to the Klingons
engine room... where they'll be no tribble at all.
Startrek -- "The Trouble With Tribbles"
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users