Skip to content

Commit

Permalink
Merge pull request #203 from AlanRace/custom-compression
Browse files Browse the repository at this point in the history
Don't panic when parsing metadata when custom compression is used
  • Loading branch information
HeroicKatora authored Mar 8, 2023
2 parents bd1d085 + d1ad9b2 commit aefea77
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/decoder/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ impl Image {
// 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.
let compression_method = match tag_reader.find_tag(Tag::Compression)? {
Some(val) => CompressionMethod::from_u16(val.into_u16()?)
.ok_or(TiffUnsupportedError::UnknownCompressionMethod)?,
Some(val) => CompressionMethod::from_u16_exhaustive(val.into_u16()?),
None => CompressionMethod::None,
};

Expand Down
2 changes: 1 addition & 1 deletion src/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub enum Type(u16) {
tags! {
/// See [TIFF compression tags](https://www.awaresystems.be/imaging/tiff/tifftags/compression.html)
/// for reference.
pub enum CompressionMethod(u16) {
pub enum CompressionMethod(u16) unknown("A custom compression method") {
None = 1,
Huffman = 2,
Fax3 = 3,
Expand Down

0 comments on commit aefea77

Please sign in to comment.