added support for the YCbCr PhotometricInterpretation
This commit is contained in:
1 parent
9333d99c92
commit
a08604b015
2 files changed
+14
No files matched your search
@@ -313,6 +313,16 @@ impl Image {
|
|||||||
self.bits_per_sample.clone(),
|
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
|
PhotometricInterpretation::BlackIsZero | PhotometricInterpretation::WhiteIsZero
|
||||||
if self.bits_per_sample.len() == 1 =>
|
if self.bits_per_sample.len() == 1 =>
|
||||||
@@ -450,6 +460,7 @@ impl Image {
|
|||||||
(ColorType::RGB(n), _)
|
(ColorType::RGB(n), _)
|
||||||
| (ColorType::RGBA(n), _)
|
| (ColorType::RGBA(n), _)
|
||||||
| (ColorType::CMYK(n), _)
|
| (ColorType::CMYK(n), _)
|
||||||
|
| (ColorType::YCbCr(n), _)
|
||||||
| (ColorType::Gray(n), _)
|
| (ColorType::Gray(n), _)
|
||||||
if usize::from(n) == buffer.byte_len() * 8 => {}
|
if usize::from(n) == buffer.byte_len() * 8 => {}
|
||||||
(ColorType::Gray(n), DecodingBuffer::U8(_)) if n < 8 => match self.predictor {
|
(ColorType::Gray(n), DecodingBuffer::U8(_)) if n < 8 => match self.predictor {
|
||||||
|
|||||||
@@ -37,4 +37,7 @@ pub enum ColorType {
|
|||||||
|
|
||||||
/// Pixel is CMYK
|
/// Pixel is CMYK
|
||||||
CMYK(u8),
|
CMYK(u8),
|
||||||
|
|
||||||
|
/// Pixel is YCbCr
|
||||||
|
YCbCr(u8)
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user