Skip to main content

apply_orientation

Function apply_orientation 

Source
pub fn apply_orientation(image: &mut RgbImage, orientation: u16)
Expand description

Apply EXIF orientation transform to correct image display.

TIFF orientation values encode how the stored image should be rotated/flipped to produce the correct upright display. This function applies the corresponding pixel transform so the output is always orientation-1 (Normal/upright).

Orientation values:

  • 1: Normal (no transform)
  • 2: Mirror horizontal
  • 3: Rotate 180°
  • 4: Mirror vertical
  • 5: Transpose (mirror horizontal + rotate 90° CCW)
  • 6: Rotate 90° CW
  • 7: Transverse (mirror horizontal + rotate 90° CW)
  • 8: Rotate 90° CCW