Skip to content

Instantly share code, notes, and snippets.

@atlc
Forked from kazzkiq/resize-images.sh
Created August 16, 2019 13:43
Show Gist options
  • Save atlc/6a02e8daffbe0f2b71cc238a26e3e55a to your computer and use it in GitHub Desktop.
Save atlc/6a02e8daffbe0f2b71cc238a26e3e55a to your computer and use it in GitHub Desktop.
[bash] Resize image and create thumbnail with ImageMagick
INDEX_RESIZE=0
for file in ./*.jpg; do
[ -e "$file" ] || continue
convert $file -resize 1000x1000^ $file
let INDEX_RESIZE=$(expr $INDEX_RESIZE+1)
done
INDEX_THUMBNAIL=0
for file in ./*.jpg; do
[ -e "$file" ] || continue
convert $file -resize 200x200^ ${INDEX_THUMBNAIL}-thumbnail.jpg
let INDEX_THUMBNAIL=$(expr $INDEX_THUMBNAIL+1)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment