Change rotation of images

We have some images that has been uploaded and has the wrong orientation, the exif orientation is “Left side, bottom (Rotate 270 CW)” but it should be “Top, left side (Horizontal / normal)”. Is there any way I can just fix this by code? I’ve tried to update just the metadata value for the orientation, but it dosent matter. Do I need to search for all with the value, download and edit and upload it again?

Litium version: 6.2.2-patch-1810041453

Orientation Exif is unfortunately not taken into account when uploading images. So I would suggest to edit the file and use the Replace file feature to replace the blob.

But if Litium isnt taken the exif orientation in account when uploading, why is the images rotated?
I have several images, and when I look at them in the file explorer they are rotated right. I upload them and they get rotated wrong. The only thing I can find on the image is the exif roation.

Could you share one example of the photo? Could it be that the file explorer automatically rotates the photo?

Here is aa image example

Thanks! It turns out that Windows explorer (if you are using Windows) and browsers like Chrome and Firefox automatically rotate the image based on the Exif orientation info to show you the image in the correct orientation. If you try to open the link you sent above in IE 11, you will see that IE does not rotate the image.

What Litium is doing is read the stream and save the blob, no rotation based on exif info. So either you can:

  1. Rotate the image manually then upload it again
  2. Implement a custom IImageResizer (under Litium.Studio.Plugins.ImageResizer namespace) to rotate the image when a request of render/resize the image happens. For example: bitmap.RotateFlip(RotateFlipType.Rotate270FlipNone);
  3. File a bug :slight_smile: