Skip to content

Instantly share code, notes, and snippets.

@madeingnecca
Last active October 11, 2015 02:38
Show Gist options
  • Save madeingnecca/3790060 to your computer and use it in GitHub Desktop.
Save madeingnecca/3790060 to your computer and use it in GitHub Desktop.
IMAGEMAGICK utils
# Convert a list of pngs to an animated gif.
convert -delay 20 -loop 0 *.png animation.gif
# Resize image
convert image.jpg -resize 150x image_resized.jpg
# Resize and crop to size.
# Note: specify the smallest dimension in -resize.
convert image.jpg -resize x300 -gravity center -crop 400x300+0+0 image_resized_and_cropped.jpg
# Resize jpg in directory
# cd "$dir"
for p in $(ls "$dir"| grep jpg); do
convert "$p" -resize 150x "$dir"/resized/"$p"
done
# Converts an image so it can be used as the screenshot of a Drupal theme.
function drupal_theme_screenshot {
convert "$1" -resize x219 -gravity center -crop 294x219+0+0 screenshot.png
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment