Mirror images with imagemagick

The new screenshot gallery on roundcube.net shows up with some nice web 2.0 mirrored images. Of course I’m not the kind of person who likes to create all of them in Photoshop. I therefore wrote a little shell script generating a mirror image using imagemagick. Here’s the code of makemirror.sh



convert -size ${width}x${height} xc:none \
\( \( -flip $infile -crop ${width}x${height}+0+0 \) \
  -size ${width}x${height} gradient: -evaluate Pow 1.4 \
  -compose Copy_Opacity -composite \) \
-compose blend -set "option:compose:args" $alpha -composite $outfile

The script takes two arguments: the input file (thumbnail) and the output file name (.png). Of course the other hard-coded parameters such as image size and opacity could be provided as arguments too.

The input file is first flipped vertically and then cropped to the size of the mirror image. After that its alpha channel (opacity) is composed with a gradient image which is generated with a quadratic function. Finally we compose that gradient thumbnail with a transparent image using the given alpha value.


2 thoughts on “Mirror images with imagemagick

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s