diff --git a/src/decoder/image.rs b/src/decoder/image.rs index c5c884f..a3a146e 100644 --- a/src/decoder/image.rs +++ b/src/decoder/image.rs @@ -313,6 +313,16 @@ impl Image { self.bits_per_sample.clone(), ), )), + } + , + PhotometricInterpretation::YCbCr => match self.bits_per_sample[..] { + [y, cb, cr] if [y, y] == [cb, cr]=> Ok(ColorType::YCbCr(y)), + _ => Err(TiffError::UnsupportedError( + TiffUnsupportedError::InterpretationWithBits( + self.photometric_interpretation, + self.bits_per_sample.clone(), + ), + )), }, PhotometricInterpretation::BlackIsZero | PhotometricInterpretation::WhiteIsZero if self.bits_per_sample.len() == 1 => @@ -450,6 +460,7 @@ impl Image { (ColorType::RGB(n), _) | (ColorType::RGBA(n), _) | (ColorType::CMYK(n), _) + | (ColorType::YCbCr(n), _) | (ColorType::Gray(n), _) if usize::from(n) == buffer.byte_len() * 8 => {} (ColorType::Gray(n), DecodingBuffer::U8(_)) if n < 8 => match self.predictor { diff --git a/src/lib.rs b/src/lib.rs index b763fc0..60bad72 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,4 +37,7 @@ pub enum ColorType { /// Pixel is CMYK CMYK(u8), + + /// Pixel is YCbCr + YCbCr(u8) }