ImageMagick Reflection

Posted by dbruns on Stack Overflow See other posts from Stack Overflow or by dbruns
Published on 2008-10-13T20:32:08Z Indexed on 2010/04/23 19:23 UTC
Read the original article Hit count: 356

Brief:

convert ( -size 585x128 gradient: )  NewImage.png

How do I change the above ImageMagick command so it takes the width and height from an existing image? I need it to remain a one line command.


Details:

I'm trying to programatically create an image reflection using ImageMagick. The effect I am looking for is similar to what you would see when looking at an object on the edge of a pool of water. There is a pretty good thread on what I am trying to do here but the solution isn't exactly what I am looking for. Since I will be calling ImageMagick from a C#.Net application I want to use one call without any temp files and return the image through stdout. So far I have this...

convert OriginalImage.png  ( OriginalImage.png -flip -blur 3x5 \
    -crop 100%%x30%%+0+0 -negate -evaluate multiply 0.3 \
    -negate  ( -size 585x128 gradient: ) +matte -compose copy_opacity -composite )
    -append NewImage.png

This works ok but doesn't give me the exact fade I am looking for. Instead of a nice solid fade from top to bottom it is giving me a fade from top left to bottom right. I added the (-negate -evaluate multiply 0.3 -negate) section in to lighten it up a bit more since I wasn't getting the fade I wanted. I also don't want to have to hard code in the size of the image when creating the gradient ( -size 585x128 gradient: ) I'm also going to want to keep the original image's transparency if possible.

To go to stdout I plan on replacing "NewImage.png" with "-"

© Stack Overflow or respective owner

Related posts about graphics

Related posts about imagemagick