ImageMagick

From Indie IT Wiki
Jump to: navigation, search

HOWTO: Watermarking

#!/bin/bash

# Initialize variables
WM=/path/to/watermark.png
SCALE=50

# Find all image files in current directory and watermark
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
  do
    echo Watermarking $IMAGE
    NAME=`echo $IMAGE | cut -f1 -d.`
    EXT=`echo $IMAGE | cut -f2 -d.`
    composite -dissolve 50% -gravity center -quality 100 \( $WM -resize $SCALE% \) "$IMAGE" "${NAME}_wm.${EXT}"
  done
exit 0

HOWTO: Resize And Change Quality

convert cover_big.jpg -resize 500x500 -quality 70 cover.jpg

HOWTO: Crop And Resize To 500x500

convert old.jpg -resize 500x500^ -gravity center -crop 500x500+0+0 +repage new.jpg

HOWTO: Crop

convert old.jpg -crop 67x67+130+0 +repage new.jpg

HOWTO: Resize

convert FlexGet_NEW.png -resize 72x72^ FlexGet_NEWER.png

HOWTO: Identify

identify FlexGet_NEWER.png

HOWTO: Display

display FlexGet_NEWER.png

Information

http://www.imagemagick.org