Welcome to the news archive. Here you'll find all the news items, ordered by date. You can use the links below to read other news items, or go back to the archive overview.
2007-05-09 10:25 - Bordering an image
Pictures look better when they have a border around them. To make things easy for me, I've written a small script that does a lot of boring things for me. It resizes an image so that it fits a 1000x1000 square, then creates a black border around it that's a slight bit larger at the bottom and places my name and website URL on the side. Here is the code:
#!/bin/bash
[ -z "$1" ] && echo "Usage: $0 <file>" && exit 1
IN="$1"
IN_NOEXT=$(echo $IN | sed 's/\\.[^.]\\+$//')
OUT="$IN_NOEXT-bordered.jpg"
echo "INPUT: $IN"
echo "OUTPUT: $OUT"
BORDER_BOTTOM=40
BORDER_OTHER=20
POINTSIZE=12
COPYRIGHT="© 2007 Sybren Stüvel - http://www.stuvel.eu/"
DIFF=$((BORDER_BOTTOM - BORDER_OTHER))
EXIFTOOL=/usr/bin/exiftool
convert "$IN" \\
-geometry 1000x1000 \\
-mattecolor black \\
-frame ${BORDER_BOTTOM}x${BORDER_BOTTOM} \\
-chop ${DIFF}x${DIFF} \\
-gravity SouthEast \\
-chop ${DIFF}x0 \\
-font Bookman-Light \\
-font Helvetica-Narrow \\
-font Helvetica\\
-pointsize $POINTSIZE \\
-gravity SouthWest \\
-fill gray20 \\
-annotate 270x270+$((POINTSIZE+2))+${BORDER_BOTTOM} \\
"$COPYRIGHT" \\
"$OUT"
$EXIFTOOL -TagsFromFile "$IN" "$OUT"
rm -f "${OUT}_original"
Comments
There are no comments on Bordering an image yet. Use the form below and be the first!
Post a comment
All fields are required, except when otherwise noted. You can use a limited subset of Restructured Text to markup the comment.
It might take up to five minutes for your comment to show up, due to caching of the pages.