Enum Orientation
pub enum Orientation
Describes the transformations to be applied to the image. Compatible with Exif orientation.
Orientation is specified in the file's metadata, and is often written by cameras.
You can apply it to an image via DynamicImage::apply_orientation.
Variants
-
NoTransforms Do not perform any transformations.
-
Rotate90 Rotate by 90 degrees clockwise.
-
Rotate180 Rotate by 180 degrees. Can be performed in-place.
-
Rotate270 Rotate by 270 degrees clockwise. Equivalent to rotating by 90 degrees counter-clockwise.
-
FlipHorizontal Flip horizontally. Can be performed in-place.
-
FlipVertical Flip vertically. Can be performed in-place.
-
Rotate90FlipH Rotate by 90 degrees clockwise and flip horizontally.
-
Rotate270FlipH Rotate by 270 degrees clockwise and flip horizontally.
Implementations
impl Orientation
fn from_exif(exif_orientation: u8) -> Option<Self>Converts from Exif orientation
fn to_exif(self) -> u8Converts into Exif orientation
fn from_exif_chunk(chunk: &[u8]) -> Option<Self>Extracts the image orientation from a raw Exif chunk.
You can obtain the Exif chunk using ImageDecoder::exif_metadata.
It is more convenient to use ImageDecoder::orientation than to invoke this function. Only use this function if you extract and process the Exif chunk separately.
fn remove_from_exif_chunk(chunk: &mut [u8]) -> Option<Self>Extracts the image orientation from a raw Exif chunk and sets the orientation in the Exif chunk to
Orientation::NoTransforms. This is useful if you want to apply the orientation yourself, and then encode the image with the rest of the Exif chunk intact.If the orientation data is not cleared from the Exif chunk after you apply the orientation data yourself, the image will end up being rotated once again by any software that correctly handles Exif, leading to an incorrect result.
If the Exif value is present but invalid,
Noneis returned and the Exif chunk is not modified.
Trait Implementations
impl Clone for Orientation
fn clone(&self) -> Self
impl Copy for Orientation
impl Debug for Orientation
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Orientation
impl Hash for Orientation
fn hash<__H: Hasher>(&self, state: &mut __H)
impl PartialEq for Orientation
fn eq(&self, other: &Self) -> bool