Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
UltraPictureBox Original Orientation
posted

Is there a way to keep the original orientation of an image?

Parents
  • 1700
    Offline posted

    Hello Stephan,

    If an image has been rotated by a specific software, it is likely that its EXIF orientation would be changed in order to rotate the image, without changing the image data. If this image is opened in Windows Photo Viewer it will be displayed correctly, since it will detect the EXIF orientation, however this is not the case while using the PictureBox or the UltraPictureBox.

    I have created a method called ChangeImageBasedOnExifOrientation, it detects if the image has an EXIF orientation, based on it, the image is rotated using the RotateFlipType enumeration.

    I am attaching a small sample application that demonstrates what I have explained above. In it I am using two different images – Tree and Tree_Modified. The Tree_Modified image is the same image, but it is rotated by 90 degrees. I am using an  OpenFileDialog to get the image and then before assigning it to the UltaPictureBox the ChangeImageBasedOnExifOrientation.

    Please test the sample on your side and let me know if you have any questions.

    Regards,
    Ivan Kitanov

    UltraPictureBoxOrientation.zip

Reply Children