Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Imagemagick commands

imagemagick

  • Nornalize all images of a folder converting them to jpgs with 90% quality (warning, removes original files):
rename 's/\.JPG$/\.jpg/' *.JPG
rename 's/\.JPEG$/\.jpg/' *.JPEG
rename 's/\.jpeg$/\.jpg/' *.jpeg
mogrify -format jpg *.png
mogrify -resize 1600x1280\> -quality 90 *.jpg
rm *.png
  • Generate 100x100 JPG thumbnails at a `/thumbs' subfolder from all JPG images of current folder, padding with black:
mkdir thumbs
mogrify -format jpg -quality 90 -path thumbs -unsharp 0x.5 -thumbnail 100x100 -background black -gravity center -extent 100x100 *.jpg
cd thumbs
rename 's/^/t_/' *.jpg

guetzli

Needs special binary

find . -type f -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \;
find . -type f -name "*.jpg" -exec rm {} +
find . -type f -name "*.jpeg" | rename "s/\.jpeg$//"

If don't want to recurse directories:

find . -type f -maxdepth 1 -name "*.jpg" -exec guetzli --quality 85 {} {}.jpeg \;
rm *.jpg
rename "s/\.jpeg$//" *.jpeg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment