convert PSD files in directory to TIFF files
#!/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