Skip to content

Instantly share code, notes, and snippets.

@iamnewton
Created January 29, 2015 18:19
Show Gist options
  • Save iamnewton/e8a0c7e0552d91b91c70 to your computer and use it in GitHub Desktop.
Save iamnewton/e8a0c7e0552d91b91c70 to your computer and use it in GitHub Desktop.
ImageMagick Tips & Tricks
# Export an Image from Layered Photoshop PSD from Command Line
# http://davidwalsh.name/export-photoshop-file-image
# usage: export_photoshop_layer website-design 1 ~/file.png
export_photoshop_layer() {
readonly FILE=$1
readonly LAYER=$2
readonly DEST=$3
convert "${FILE}.psd[${LAYER}]" $DEST
}
# Create Image Thumbnails with ImageMagick
# http://davidwalsh.name/create-image-thumbnails-imagemagick
# usage: create_thumbnail billboard.png 32x32 thumbnail.png
create_thumbnail() {
readonly FILE=$1
readonly SIZE=$2
readonly DEST=$#
convert $FILE -trim -resize $SIZE $DEST
}
# Get the First Frame of an Animated GIF with ImageMagick
# http://davidwalsh.name/first-frame-animated-gif
# usage: /opt/ImageMagick/bin/convert monkey 0 monkey-frame
create_animated_gif_thumbnail() {
readonly FILE=$1
readonly FRAME=$2
readonly DEST=$#
convert "${FILE}.gif[$FRAME]" "${DEST}.gif"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment