Traditionally, images are displayed in the orientation in which they are stored. It is possible to mark an image to be displayed in a different orientation by using the EXIF Orientation tag. Modern web browsers and some image software will automatically adjust the display based on this tag, while older packages might not. This can lead to compatibility problems where the same image can be displayed in two different orientations. If you experience this, it is quite likely caused by the EXIF Orientation tag.
We have a code snippet showing how to read the Orientation tag and rotate and/or flip the image to get it into the correct orientation, and then the EXIF data can be safely removed.
Set Image = Server.CreateObject("csImageFile64.Manage")
Image.ReadFile "C:\path\to\image.jpg"
Select Case Image.ExifValueByName("Orientation")
Case "1" : 'Do nothing
Case "2" : Image.FlipY
Case "3" : Image.Rotate 180
Case "4" : Image.FlipX
Case "5" : Image.Rotate 90
Image.FlipX
Case "6" : Image.Rotate -90
Case "7" : Image.FlipY
Image.Rotate -90
Case "8" : Image.Rotate 90
End Select
Image.ExifClear
There are eight possible values for the orientation representing the the four rotations, each of which can be mirrored. The default is 1, which matches the pixel scanlines.
This code shows the EXIF block being deleted after adjusting the orientation. Other options would be to set the Orientation tag to 1 or to delete the tag. EXIF data can be bulky and it the target is to reduce the file size, using ExifClear may be better.
© Chestysoft, 2026.