Created
March 24, 2016 20:53
-
-
Save Grauwolf/7c3a7b60a30923d64917 to your computer and use it in GitHub Desktop.
convert PSD files in directory to TIFF files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# psd2tiff - convert PSD files in directory to TIFF files | |
set -euo pipefail | |
input_dir="" | |
output_dir="" | |
show_help() { | |
cat << EOF | |
Usage: ${0##*/} [-h] [-i INDIR] [-o OUTDIR] | |
-h display this help and exit | |
-i INDIR directory with PSD files | |
-o OUTDIR write the result files to OUTDIR | |
EOF | |
} | |
while getopts "h:i:o:" opt | |
do | |
case "$opt" in | |
h) | |
show_help | |
exit 0 | |
;; | |
i) | |
input_dir="$OPTARG" | |
;; | |
o) | |
output_dir="$OPTARG" | |
;; | |
\?) | |
echo "Invalid option: ${OPTARG}" >&2 | |
show_help >&2 | |
exit 1 | |
;; | |
esac | |
done | |
shift "$((OPTIND-1))" | |
if [ ! -z "$input_dir" ] && [ ! -z "$output_dir" ] | |
then | |
find "$input_dir" -type f -iname "*.psd" -print0 \ | |
| parallel -0 -j4 convert "{}" -flatten -profile ColorMatchRGB.icc "${output_dir}/{/.}.tiff" | |
echo "Done!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment