JPEG-Images coming from modern cameras have EXIF data which describes the orientation of the image.
When you view photos in modern image viewer (Google Picasa, Windows Picture Viewer >= Windows 8) then it is displayed in the correct orientation.
Webbrowsers and old image viewers (like Windows Picture Viewer <= Windows 7) show the images like they are saved, so they would not rotate an image for display, even if the EXIF data says, the picture needs rotation.
What can you do?
- Don't rotate the images in your "old" Desktop Image viewer, it would rotate the image without changing the EXIF orientation data, which would give you a wrong orientation when you watch it in modern image viewers.
- You can use a tool (search for exif autorotate) to normalize the orientation of all images, so they have the right orientation in all viewers including web.
- Or you can - if you want to solve this problem in the future - build a ListItem EventReceiver which reads the EXIF orientation data and then rotates the image. So your EventReceiver would "normalize" the orientation on upload.
Here is a codesnipped how you can perform this:
/// Return the orientation of the photo
/// <param name="img"></param>
/// <returns>Orientation (1 = correct, 6 = requires rotation to the right, 8 = requires rotation to the left)</returns>
public Int16? GetOrientation(Image img)
// 274 Orientation (Short)
PropertyItem propItem = img.GetPropertyItem(274);
return BitConverter.ToInt16(propItem.Value, 0);
Image image = new Bitmap(imageStream);
Int16? orientation = GetOrientation(image);
if (orientation.HasValue && (orientation == 6 || orientation == 8))
// Now rotate it with some .NET features
I don't know, if your image viewer programs all sucks or if the browser displays the image in the other orientation based on EXIF data.
Take a look on this article, the first answer.
Modern browsers have a
css property, which is maybe used (or not used) by SharePoint to rotate (or not rotate) the image on view.