Christoph Polcin

resize & watermark your images

If You looking for a smart gui-less way to resize and watermark your images then try out Im­ageMag­ick. Use the following shell script to wrap and simplify the call. Copy it into your ~/bin folder an adjust the variables at the top. Execute it with a source image and des­ti­na­tion path as arguments.

Some helpful hints:

Copy to ~/bin/downscale

#!/bin/sh
# www.christoph-polcin.com

[ $# != "2" ] && \
    echo "usage: downscale <source> <destination>" && exit 1

WATERMARK='WWW.CHRISTOPH-POLCIN.COM'
# get from http://fontzone.net/font-details/Agency+FB/
FONT='AgencyFB-Bold'
# get from http://www.fontsquirrel.com/fonts/download/roboto
#FONT='Roboto-Thin'
FONTSIZE=72
COLOR='#999999AA'

MAX_W=1280
MAX_H=896
QUALITY=85

echo "converting $1"
convert \
    -flatten \
    -alpha On \
    -font $FONT \
    -pointsize $FONTSIZE \
    -fill $COLOR \
    -gravity NorthEast -annotate +60+20 "${WATERMARK}" \
    -gravity SouthWest -annotate +60+20 "${WATERMARK}" \
    -resize "${MAX_W}x${MAX_H}>" \
    -quality $QUALITY \
    "$1" "$2"