Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update apply_orientation doc comment to use .orientation() #2346

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ num-complex = "0.4"
glob = "0.3"
quickcheck = "1"
criterion = "0.5.0"
kamadak-exif = "0.5.5"

[features]
default = ["rayon", "default-formats"]
Expand Down
19 changes: 3 additions & 16 deletions src/dynimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -940,25 +940,12 @@ impl DynamicImage {
///
/// ```
/// # fn only_check_if_this_compiles() -> Result<(), Box<dyn std::error::Error>> {
/// # use image::{Orientation, DynamicImage, ImageReader, ImageDecoder};
/// use exif::{In, Tag}; // third-party crate `kamadak_exif` is needed to parse Exif chunk
/// use image::{Orientation, DynamicImage, ImageReader, ImageDecoder};
///
/// let mut decoder = ImageReader::open("file.jpg")?.into_decoder()?;
/// let raw_exif = decoder.exif_metadata();
/// let orientation = decoder.orientation()?;
/// let mut image = DynamicImage::from_decoder(decoder)?;
///
/// // Parse Exif chunk (if present) and apply the orientation
/// if let Ok(Some(raw_exif)) = raw_exif {
/// let reader = exif::Reader::new();
/// let exif = reader.read_raw(raw_exif)?;
/// if let Some(orientation) = exif.get_field(Tag::Orientation, In::PRIMARY) {
/// if let Some(value) = orientation.value.get_uint(0) {
/// if let Some(orientation) = Orientation::from_exif(value as u8) {
/// image.apply_orientation(orientation);
/// }
/// }
/// }
/// }
/// image.apply_orientation(orientation);
/// # Ok(())
/// # }
/// ```
Expand Down
2 changes: 1 addition & 1 deletion src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use byteorder_lite::{BigEndian, LittleEndian, ReadBytesExt};
/// Describes the transformations to be applied to the image.
/// Compatible with [Exif orientation](https://web.archive.org/web/20200412005226/https://www.impulseadventure.com/photo/exif-orientation.html).
///
/// Orientation is specified in the Exif metadata, and is often written by cameras.
/// 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`](crate::DynamicImage::apply_orientation).
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
Expand Down
Loading