Merge pull request #190 from kurtkuehnert/YCbCr_support

Added support for the YCbCr PhotometricInterpretation
This commit is contained in:
Jonathan Behrens authored and GitHub committed 2023-01-06 23:54:16 -08:00
commit 0da9770916
5 files changed
+26

No files matched your search

+10
View File
@@ -305,6 +305,15 @@ impl Image {
),
)),
},
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 =>
{
@@ -464,6 +473,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 {