Skip to content

Commit a603ed1

Browse files
authored
Merge pull request #226 from image-rs/current-frame-info
Add Decoder::current_frame_info
2 parents 9d292eb + 090e0b9 commit a603ed1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/reader/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,17 @@ where
449449
Ok(Some(&self.current_frame))
450450
}
451451

452+
/// Query information about the frame previously advanced with [`Self::next_frame_info`].
453+
///
454+
/// Returns `None` past the end of file.
455+
pub fn current_frame_info(&self) -> Option<&Frame<'static>> {
456+
if self.decoder.at_eof {
457+
None
458+
} else {
459+
Some(&self.current_frame)
460+
}
461+
}
462+
452463
/// Reads the next frame from the image.
453464
///
454465
/// Do not call `Self::next_frame_info` beforehand.

0 commit comments

Comments
 (0)