Merge pull request #203 from AlanRace/custom-compression
Don't panic when parsing metadata when custom compression is used
This commit is contained in:
2 files changed
+2
-3
No files matched your search
@@ -109,8 +109,7 @@ impl Image {
|
|||||||
// Try to parse both the compression method and the number, format, and bits of the included samples.
|
// Try to parse both the compression method and the number, format, and bits of the included samples.
|
||||||
// If they are not explicitly specified, those tags are reset to their default values and not carried from previous images.
|
// If they are not explicitly specified, those tags are reset to their default values and not carried from previous images.
|
||||||
let compression_method = match tag_reader.find_tag(Tag::Compression)? {
|
let compression_method = match tag_reader.find_tag(Tag::Compression)? {
|
||||||
Some(val) => CompressionMethod::from_u16(val.into_u16()?)
|
Some(val) => CompressionMethod::from_u16_exhaustive(val.into_u16()?),
|
||||||
.ok_or(TiffUnsupportedError::UnknownCompressionMethod)?,
|
|
||||||
None => CompressionMethod::None,
|
None => CompressionMethod::None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -172,7 +172,7 @@ pub enum Type(u16) {
|
|||||||
tags! {
|
tags! {
|
||||||
/// See [TIFF compression tags](https://www.awaresystems.be/imaging/tiff/tifftags/compression.html)
|
/// See [TIFF compression tags](https://www.awaresystems.be/imaging/tiff/tifftags/compression.html)
|
||||||
/// for reference.
|
/// for reference.
|
||||||
pub enum CompressionMethod(u16) {
|
pub enum CompressionMethod(u16) unknown("A custom compression method") {
|
||||||
None = 1,
|
None = 1,
|
||||||
Huffman = 2,
|
Huffman = 2,
|
||||||
Fax3 = 3,
|
Fax3 = 3,
|
||||||
|
|||||||
Reference in new issue
Block a user