You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.4 KiB

imgfolders=(
"00_contributions/FINAL/02_clara-images"
"00_contributions/FINAL/05_rosemary-interview-images"
"00_contributions/FINAL/06_michael-images"
)
exts=(jpg JPG png PNG jpeg JPEG)
exceptions=(
"00_contributions/FINAL/06_michael-images/dbn.png"
"00_contributions/FINAL/06_michael-images/06_psquare2.png"
"00_contributions/FINAL/06_michael-images/10_background2.png"
"00_contributions/FINAL/06_michael-images/11_img.png"
"00_contributions/FINAL/06_michael-images/12_flag.png"
"00_contributions/FINAL/06_michael-images/13_forthevoice.png"
"00_contributions/FINAL/05_rosemary-interview-images/01.png"
"00_contributions/FINAL/05_rosemary-interview-images/02.png"
"00_contributions/FINAL/05_rosemary-interview-images/04.png"
)
for imgfolder in "${imgfolders[@]}"; do
newimgdir="${imgfolder}/grayscale"
mkdir -p $newimgdir
for ext in "${exts[@]}"; do
for img in "$imgfolder/"*."$ext"; do
if [ -f $img ]; then
contrast=false
newimg="${newimgdir}/${img##*/}"
echo $newimg processing...
for exception in "${exceptions[@]}"; do
if [ $exception == $img ]; then
contrast=true
break
fi
done
if [ $contrast = true ]; then
convert $img -colorspace Gray $newimg
else
convert $img -set colorspace Gray -separate -average $newimg
fi
fi
done
done
done