Advertisement
chrisjrob

mkthumbs

Apr 29th, 2022
1,124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # mkthumbs
  4. #
  5. # Receives a filelist on STDIN and converts each to desired geometry
  6. # Requires GraphicsMagick
  7. #
  8. # Will probably work with ImageMagick by simply removing the "gm " from "gm convert"
  9.  
  10. echo "USAGE: filelist | mkthumbs 200x150"
  11.  
  12. GEOMETRY="$1"
  13.  
  14. while read -r line
  15. do
  16.     NEWNAME=${line/\.jpg/"-$GEOMETRY.jpg"}
  17.     echo "Converting $line to $NEWNAME"
  18.     gm convert "$line" -geometry "$GEOMETRY^" -gravity Center -crop "$GEOMETRY+0+0" -quality 90 "$NEWNAME"
  19. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement