you could check exif.imagewidth > exif.imagelength for landscape. if you change or add the exif orientation "jpeg" viewers and editibg software may rotate the image incorrectly.