Posts Tagged ‘script’

We’ve started using a quick ImageMagick script to add shadows and borders to images. Useful for making screen shots stand out a little clearer on our blog and wiki.

For example, in a unix shell, create the function below (either by cutting and pasting the code into your shell window or adding to you shell init scripts) :

1
2
3
4
5
6
7
8
9
10
11
image-shadow () {
  out=${1%.*}-shadow.${1#*.}
  in=$1
  echo "Converted file : $out"
  if [ ! -z $2 ] ; then 
    convert $in -frame $2 $out
    in=$out
  fi
  convert $in \( +clone -background black -shadow 60x5+10+10 \) \
    +swap -background white -layers merge +repage $out
}

and then run

image-shadow myimage.png

to add a shadow to the image … or run

image-shadow myimage.png 6x6

to add a shadow and 6 pixel border.

Very simple to get images like …

Mex 2009 mobile web site

More examples and details on our wiki @ http://bemoko.com/wiki/ImageMagick.

Posted in: mobile No Comments