#!/bin/bash
# border

# puts a border around ALL the  png and jpg photos in the directory
# saves the originals to a directory ORIGINALS/  and in the current directory 
# and adds "border_" to the new file

# change the following  values as desired
#  colour: #EEAA00 (brownish)  
#  border: 10 pixels wide 


# first eliminate the old ORIGINALS/ because if repeat
# one obtains nested ORIGINALS/!

rm -fR ORIGINALS/

# eliminate the extensions with capital letters
# no loop for rename
   rename  .PNG  .png  *.PNG
   rename  .JPG  .jpg  *.JPG

# new originals
mkdir ORIGINALS/
cp * ORIGINALS/


#  png
for img in `ls *.png`
do
     convert -mattecolor "#EEAA00" -frame 10x10 $img  border_$img
done


#  jpg
for img in `ls *.jpg`
do
     convert -mattecolor "#EEAA00" -frame 10x10 $img  border_$img
done