[magick-users] Mathematical Cloud Composition

David Vanderson dvanderson at customink.com
Mon Jul 9 15:43:21 PDT 2007


Hello Ashton,

I've done a very similar thing to what you want using the -fx operator 
like so:

-channel A -fx intensity

The -channel says to affect only the alpha channel, and "intensity" is a 
built-in.  See http://www.imagemagick.org/Usage/transform/#fx for great 
examples.  In your case I did this (there's probably a more efficient way):

convert nzdaylp9.png nzcloudstc9.jpg \( +clone -channel A -fx 
'(r+g+b)*(r+g+b)/(3*3)' \) -delete 1 -composite output.png

Good luck,
Dave

Ashton Peters wrote:
> Hi, I have a question related to image composition and transparency. I 
> have two satellite images, one is a map, and one is a cloud image.
>
> Map: http://img379.imageshack.us/img379/4205/nzdaylp9.png (700k)
>
> Clouds: http://img465.imageshack.us/img465/3254/nzcloudstc9.jpg (300k)
>
> What I would like to do is combine these images to make a realistic 
> looking cloud overlay. I have read a technical report available at
>
> http://www.urania.be/weer/cloudmaps20060203.pdf
>
> that obtained great results using alpha blending as a function of 
> cloud image pixel intensity. An equation is used that applies a 
> transparency to each pixel of the cloud image based on the following 
> formula:
>
> alpha = (cloudgrey^2) / (255^2)
>
> where alpha is the output pixel transparency value, and cloudgrey is 
> the greyscale value of the cloud image pixel (between 0-255).
>
> Is it possible to use ImageMagick to create a transparency map as an 
> arbitrary function of pixel values, then apply the transparency map to 
> compose the two images? I have experimented with the built-in alpha 
> compositing methods in ImageMagick and I can't seem to find one that 
> allows the creation of a transparency map based on a user-defined 
> function.
>
> Any help would be most appreciated.
>
> Regards,
>
> Ashton
>
> _________________________________________________________________
> Live Search delivers results the way you like it. Try live.com now! 
> http://www.live.com
>
> _______________________________________________
> Magick-users mailing list
> Magick-users at imagemagick.org
> http://studio.imagemagick.org/mailman/listinfo/magick-users


More information about the Magick-users mailing list