Skip to content

Instantly share code, notes, and snippets.

@kazzkiq
Created November 16, 2017 20:55
Show Gist options
  • Save kazzkiq/f850f33a5056252e88944944bc87758d to your computer and use it in GitHub Desktop.
Save kazzkiq/f850f33a5056252e88944944bc87758d 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
@kazzkiq
Copy link
Author

kazzkiq commented Nov 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment