Parse all homogeneous bit depth RGB(A) color types
Make the behavior of RGB and RGBA like Gray in returning ColorTypes for all homogeneous bit depths, even if those depths are not 8, 16, 32 or 64. Note that this does not change which color types can actually be decoded.
This commit is contained in:
1 parent
6e61de81b6
commit
e5d2e7862c
1 file changed
+3
-9
+3
-9
@@ -353,15 +353,9 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
match self.photometric_interpretation {
|
match self.photometric_interpretation {
|
||||||
// TODO: catch also [ 8, 8, 8, _] this does not work due to a bug in rust atm
|
// TODO: catch also [ 8, 8, 8, _] this does not work due to a bug in rust atm
|
||||||
PhotometricInterpretation::RGB => {
|
PhotometricInterpretation::RGB => {
|
||||||
match self.bits_per_sample.as_slice() {
|
match self.bits_per_sample[..] {
|
||||||
[8, 8, 8] => Ok(ColorType::RGB(8)),
|
[r, g, b] if [r, r] == [g, b] => Ok(ColorType::RGB(r)),
|
||||||
[8, 8, 8, 8] => Ok(ColorType::RGBA(8)),
|
[r, g, b, a] if [r, r, r] == [g, b, a] => Ok(ColorType::RGBA(r)),
|
||||||
[16, 16, 16] => Ok(ColorType::RGB(16)),
|
|
||||||
[16, 16, 16, 16] => Ok(ColorType::RGBA(16)),
|
|
||||||
[32, 32, 32] => Ok(ColorType::RGB(32)),
|
|
||||||
[32, 32, 32, 32] => Ok(ColorType::RGBA(32)),
|
|
||||||
[64, 64, 64] => Ok(ColorType::RGB(64)),
|
|
||||||
[64, 64, 64, 64] => Ok(ColorType::RGBA(64)),
|
|
||||||
_ => Err(TiffError::UnsupportedError(
|
_ => Err(TiffError::UnsupportedError(
|
||||||
TiffUnsupportedError::InterpretationWithBits(
|
TiffUnsupportedError::InterpretationWithBits(
|
||||||
self.photometric_interpretation,
|
self.photometric_interpretation,
|
||||||
|
|||||||
Reference in new issue
Block a user