Skip to content

Commit dd87098

Browse files
authored
Merge pull request #2346 from Shnatsel/orientation-doc-comment
Update apply_orientation doc comment to use `.orientation()`
2 parents 3b10606 + e502e48 commit dd87098

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ num-complex = "0.4"
6262
glob = "0.3"
6363
quickcheck = "1"
6464
criterion = "0.5.0"
65-
kamadak-exif = "0.5.5"
6665

6766
[features]
6867
default = ["rayon", "default-formats"]

src/dynimage.rs

+3-16
Original file line numberDiff line numberDiff line change
@@ -940,25 +940,12 @@ impl DynamicImage {
940940
///
941941
/// ```
942942
/// # fn only_check_if_this_compiles() -> Result<(), Box<dyn std::error::Error>> {
943-
/// # use image::{Orientation, DynamicImage, ImageReader, ImageDecoder};
944-
/// use exif::{In, Tag}; // third-party crate `kamadak_exif` is needed to parse Exif chunk
943+
/// use image::{Orientation, DynamicImage, ImageReader, ImageDecoder};
945944
///
946945
/// let mut decoder = ImageReader::open("file.jpg")?.into_decoder()?;
947-
/// let raw_exif = decoder.exif_metadata();
946+
/// let orientation = decoder.orientation()?;
948947
/// let mut image = DynamicImage::from_decoder(decoder)?;
949-
///
950-
/// // Parse Exif chunk (if present) and apply the orientation
951-
/// if let Ok(Some(raw_exif)) = raw_exif {
952-
/// let reader = exif::Reader::new();
953-
/// let exif = reader.read_raw(raw_exif)?;
954-
/// if let Some(orientation) = exif.get_field(Tag::Orientation, In::PRIMARY) {
955-
/// if let Some(value) = orientation.value.get_uint(0) {
956-
/// if let Some(orientation) = Orientation::from_exif(value as u8) {
957-
/// image.apply_orientation(orientation);
958-
/// }
959-
/// }
960-
/// }
961-
/// }
948+
/// image.apply_orientation(orientation);
962949
/// # Ok(())
963950
/// # }
964951
/// ```

src/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use byteorder_lite::{BigEndian, LittleEndian, ReadBytesExt};
55
/// Describes the transformations to be applied to the image.
66
/// Compatible with [Exif orientation](https://web.archive.org/web/20200412005226/https://www.impulseadventure.com/photo/exif-orientation.html).
77
///
8-
/// Orientation is specified in the Exif metadata, and is often written by cameras.
8+
/// Orientation is specified in the file's metadata, and is often written by cameras.
99
///
1010
/// You can apply it to an image via [`DynamicImage::apply_orientation`](crate::DynamicImage::apply_orientation).
1111
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]

0 commit comments

Comments
 (0)