Jud Dagnall Photography Blog

Photography, technology and occasional rants!

Projector images via ImageMagick

Posted on March 7th, 2006 in by jud || No Comment

The Palo Alto Camera Club has a monthly digital “slides” competition. As part of an ongoing project to automate image submission, I’m creating several scripts to resize/frame and “mat” the images using ImageMagick, a command line utility for windows and linux. It could be also be done via photoshop actions and/or scripting, but since this will eventually be running on a server, I wanted to do outside of photoshop.

The basic requirement is that the final image should be 1024×768 pixels (the resolution of our digital project). If the image is smaller than this, then it should be placed on a black background ‘mat’. The club guidelines require an image that is max1000x750 pixels, and then note that a simple border will be added. So my image magick script does the following:

  1. Read an image named input_image.jpg
  2. Resize the image to a max of 1000×750 pixels (length x width).
  3. Place a 1px white border around the image
  4. Place a 1px black border around the image
  5. Center the final image on a black background that is 1024×768 pixels.
  6. Sharpen the image
  7. Save as a quality 85% jpeg with the name “output_image.jpg”

And now, the script:

convert -size 1000x750 input_image.jpg -resize 1000x750 \
-bordercolor black -border 1 \
-bordercolor white -border 1 - \
|\
composite -gravity center - \
-size 1024x768 xc:black \
-sharpen 0x1.0 -quality 85 \
output_image.jpg

Leave a Reply

Your email address will not be published. Required fields are marked *