Skip to content

Instantly share code, notes, and snippets.

@dpaluy
Last active September 20, 2019 09:24
Show Gist options
  • Select an option

  • Save dpaluy/1f85ac4ba45e0f685ba1dd18fda1b306 to your computer and use it in GitHub Desktop.

Select an option

Save dpaluy/1f85ac4ba45e0f685ba1dd18fda1b306 to your computer and use it in GitHub Desktop.
Convert multipage images to JPG
#!/bin/bash
# Requires: http://www.graphicsmagick.org/
FILES="origin/*.TIF"
OUTPUT_FOLDER="results/"
SPLIT="_"
for filename in $FILES; do
fbname=$(basename "$filename" | cut -d. -f1)
# gm convert "$filename" +adjoin "inputs/$fbname$SPLIT%02d.jpg"
gm convert "$filename[0]" "$OUTPUT_FOLDER$fbname.jpg"
echo "File $filename converted"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment