added support for the YCbCr PhotometricInterpretation

This commit is contained in:
Kurt Kühnert committed 2022-11-16 17:33:39 +01:00
1 parent 9333d99c92
commit a08604b015
2 files changed
+14

No files matched your search

+11
View File
@@ -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 {