We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c8e2525 commit 8734980Copy full SHA for 8734980
src/decoder.rs
@@ -36,6 +36,17 @@ pub enum PixelFormat {
36
CMYK32,
37
}
38
39
+impl PixelFormat {
40
+ /// Determine the size in bytes of each pixel in this format
41
+ pub fn pixel_size(&self) -> usize {
42
+ match self {
43
+ Self::L8 => 1,
44
+ Self::RGB24 => 3,
45
+ Self::CMYK32 => 4,
46
+ }
47
48
+}
49
+
50
/// Represents metadata of an image.
51
#[derive(Clone, Copy, Debug, PartialEq)]
52
pub struct ImageInfo {
0 commit comments