function IEReadCorrectOrientationOfImageFile(const sFilename : string; bConservativeChecking : Boolean = True) : Integer;
Upmarket digital cameras will automatically store the correct orientation of an image when the camera is rotated to take a portrait photo. This function calls EXIF_Orientation
to retrieve the desired orientation for a JPEG camera image.
If bConservativeChecking is true it performs some further checking to ensure the returned value is accurate (e.g. to avoid problems where the photo has already been rotated in another program).
iBestOrientation := IEReadCorrectOrientationOfImageFile('D:\MyImage.jpeg', True);