I suppose I could break the operation into smaller chunks but I would prefer to do it all at once and just leave the computer while it works. Any thoughts? Thanks for the help.
Code: Select all
#!/bin/bash
if [ ! -d ./Hero ]; then mkdir ./Hero;
fi
if [ ! -d ./Gallery ]; then mkdir ./Gallery;
fi
echo "Converting .jpg's..."
mogrify -format png "*.jpg"
echo "Converting .psd's..."
mogrify -format png *.psd[1]
echo "Converting .gif's..."
mogrify -format png *.gif
echo "Converting .tif's..."
mogrify -format png *.tif
echo "Conversion Complete; now formatting..."
for f in "*.png";
do
echo "Formatting image as hero shot: $f"
convert -set density 38 -units PixelsPerCentimeter \
-bordercolor white -border 1x1 \
-alpha set -channel RGBA -fuzz 3% \
-fill none -floodfill +0+0 white \
-shave 1x1 \
-blur 0x.3 \
-trim +repage \
-resize 230x375 \
$f ./Hero/$f
done
echo "Process complete; Hero shots created in folder: Hero"
for f in "*.png";
do
echo "Formatting gallery image: $f"
convert -set density 38 -units PixelsPerCentimeter \
-bordercolor white -border 1x1 \
-alpha set -channel RGBA -fuzz 1% \
-trim +repage \
-resize 950x800 \
-background white -gravity center -extent 1920x1080+1-50 \
$f ./Gallery/$f
done
echo "Images formatted; now converting to .jpg"
cd Gallery
for f in "*.png";
do
echo "Converting gallery image: $f"
mogrify -format jpg "*.png"
done
echo "Removing temporary files..."
rm *.png
cd
rm *.png
rm *.jpg
rm *.gif
rm *.psd
echo "Process complete; Gallery images created in folder: Gallery; Hero shots created in folder: Hero"
echo -e "\a"