LOCAL ExifTargetOrientation AS Integer * the pretended orientation (left - bottom) m.ExifTargetOrientation = 0h0800 LOCAL IdExifOrientation AS Integer m.IdExifOrientation = 0x112 LOCAL JPEGImage * get a JPEG image from disk JPEGImage = _Screen.System.Drawing.Image.Fromfile(GETFILE("jpg")) LOCAL LoopProperties AS Integer LOCAL ExifOrientation AS Integer m.ExifOrientation = 0 * locate EXIF orientation setting FOR m.LoopProperties = 1 TO m.JPEGImage.PropertyItems.Count * found it? get its index IF m.JPEGImage.PropertyIdList(m.LoopProperties) = m.IdExifOrientation m.ExifOrientation = m.LoopProperties EXIT ENDIF ENDFOR * not found... IF m.ExifOrientation = 0 MESSAGEBOX("No EXIF orientation settings found in the image") RETURN ENDIF LOCAL ExifProperty * get the orientation property m.ExifProperty = m.JPEGImage.GetPropertyItem(m.IdExifOrientation) * and check its value - if already set as the target orientation, just leave as it is IF m.ExifProperty.Value = m.ExifTargetOrientation MESSAGEBOX("EXIF orientation already set to " + TRANSFORM(m.ExifTargetOrientation)) RETURN ENDIF * set the target orientation setting and put the property back in the image m.ExifProperty.Value = m.ExifTargetOrientation m.JPEGImage.SetPropertyItem(m.ExifProperty) * save the image m.JPEGImage.Save(PUTFILE("Reoriented:","reoriented.jpg","jpg"), _Screen.System.Drawing.Imaging.ImageFormat.Jpeg)