To resize all the JPEG files in a directory so that one of the dimensions is maximum 800 pixels.
The \> implies that the images will only be made smaller, never bigger

ImageMagick must be installed

 mkdir tmp  
 for file in `ls *jpg`; do echo $file; convert $file -resize 800x800\> tmp/$file; done