Using a simple command line command it is very simple to rotate any number of images using the exif data (hopefully) contained in the image. Most cameras will save the exif data and include the camera rotation when the photograph was taken.
sudo apt-get install jhead
then when we run the following command in the folder it will losslessly rotate the photographs that need it.
jhead -autorot *
Job done :]