Commit Graph
375 Commits
Author SHA1 Message Date
Andrew Champion c2084835fa Add support for IEEEFP Gray/RGB/RGBA/CMYK(64) decoding 2020-02-10 13:21:16 +00:00
Andrew Champion 97c888f166 Add support for IEEEFP RGB/RGBA/CMYK(32) decoding 2020-02-10 13:21:13 +00:00
Andrew Champion 24d347ecf5 Tests: add regression test for issue 69 2020-02-09 18:37:16 +00:00
Andrew Champion a439baa948 Decoder: remove test make wrong assumption
The byte count for strips is the compressed length. The compressed
length may be larger than the uncompressed length, especially with poor
compression choices (multi-byte samples with packbits) or small images.
2020-02-09 18:37:16 +00:00
Andrew Champion 6e23274bea Decoder: max uncompressed length for LZW must respect buffer byte length
Fixes #69.
2020-02-09 18:24:22 +00:00
Andrew Champion bbc49291e4 Add support for IEEEFP Gray(32) decoding 2020-02-06 18:40:41 +00:00
HeroicKatora 119dec5068 Merge pull request #67 from aschampion/issues/misc-cleanup
Refactoring, cleanup, safety, docs & CMYK(16|32|64) support
2020-02-06 17:55:26 +01:00
Andrew Champion ec0477125f Tags: restore primitive conversions as inherent methods 2020-02-01 18:25:05 +00:00
Andrew Champion 1c8e98bca5 Squash to cast checking 2020-01-02 12:47:39 +00:00
Andrew Champion e6985063ac Fix formatting in README table 2019-12-21 15:57:24 +00:00
Andrew Champion 42c94ac3d9 Add support for CMYK(16|32|64) encoding 2019-12-21 15:57:24 +00:00
Andrew Champion eadec8f0b9 Remove most unchecked size/index casts
Convert most unchecked size/index `as` casts to checked casts with
`TryFrom`, included another top-level error variant.

This has several motivations:
- Making the library as robust as possible, including to platform
differences.
- Unchecked casts are susceptible to breakage during refactorings.
- Preparing for BigTIFF support, which will require the introduction of
generics and associated types for some parts of the de/encoders.
Unchecked primitive casts cannot be bound, while TryFrom can, and
overflowing conversions become more likely.
- Remaining u16 casts may be prone in failure in existing practice and
not just in theory during future changes.
2019-12-21 15:57:24 +00:00
Andrew Champion 462697e373 Add support for CMYK(16|32|64) decoding 2019-12-21 15:57:24 +00:00
Andrew Champion c537f5cc64 Add decode test for CMYK(8) 2019-12-21 15:57:24 +00:00
Andrew Champion 8f61196d70 Note 32 and 64 bit support in README 2019-12-21 15:57:24 +00:00
Andrew Champion 298dc8841d Remove unchecked casts and magic values for some tags 2019-12-21 15:57:24 +00:00
Andrew Champion f92be13f6c Factor tags into own module
Tag representations are not decoder- or encoder-specific, so should live
in their own module accessible to both for reuse. The decoder::ifd
module remains since this module is mainly dedicated to decoding the
IFD.
2019-12-21 15:57:24 +00:00
Andrew Champion f9cace84da Deduplicate primitive conversions for tag enum 2019-12-21 15:57:24 +00:00
Andrew Champion d510a9f4ab Strictly handle expected tag value types
Resolve several TODOs where tag values were cast from u32 without checks
by providing generic methods that error when the value fails casting to
the desired type. In addition to being more correct, this simplifies and
shortens decoding logic.

Remove `find_tag_u32` and `find_tag_u32_vec` as they are now redundant
and a GitHub code search found no usages outside copies of
`image-tiff`.
2019-12-21 15:57:24 +00:00
Andrew Champion 1fafcccb36 Remove needless cast (minor) 2019-12-21 15:57:24 +00:00
Andrew Champion 8b96793671 Simplify expression (minor) 2019-12-21 15:57:24 +00:00
Andrew Champion 27ae65160d Deduplicate decoding buffer construction 2019-12-21 15:57:24 +00:00
Andrew Champion 29bb8c2dfe Summarize supported features in README 2019-12-21 15:57:24 +00:00
Andrew Champion c5fcba45a0 Fix typo in error display message 2019-12-21 15:57:24 +00:00
HeroicKatora cbaa9dbc5b Merge pull request #68 from aschampion/refactors/test-dedup
Deduplicate tests and remove tempfile dev-dependency
2019-12-21 16:47:42 +01:00
Andrew Champion 959254aee9 Deduplicate encoding tests
Also removes dev dependency on tempfile.
2019-12-21 15:12:25 +00:00
Andrew Champion 3f14098060 Deduplicate decoding tests 2019-12-21 15:11:47 +00:00
Andrew Champion 57783ba43f Merge pull request #66 from aschampion/features/32-bit
Support 32- and 64-bit integer sample grayscale and RGB(A) images
2019-12-19 13:19:35 +00:00
Andrew Champion abd6aee19f Remove outdate and ambiguous TODO (minor) 2019-12-16 22:10:57 +00:00
Andrew Champion c72a8d364d Add tests for exotic 12-bit sample images
These images should correctly report their color depths, but fail to
decode as they are unsupported.
2019-12-16 18:53:44 +00:00
Andrew Champion e5d2e7862c 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.
2019-12-11 15:03:05 +00:00
Andrew Champion 6e61de81b6 Simplify color type matching 2019-12-11 12:56:11 +00:00
Andrew Champion 8c4cea5d97 Support 64-bit encoding
Note that this adds the LONG8 data type from BigTIFF because of bounds
requiring TiffValue. However, this datatype should not actually be
written to tags.
2019-12-10 20:18:53 +00:00
Andrew Champion 0c53e1066a Support 64-bit rgb and rgba decoding 2019-12-10 20:18:53 +00:00
Andrew Champion f4e985e0bd Support 64-bit grayscale decoding 2019-12-10 20:18:53 +00:00
Andrew Champion af010edcfd Support 32-bit encoding 2019-12-10 20:18:53 +00:00
Andrew Champion f32b3b9d10 Fix warnings in encoding test 2019-12-10 20:18:53 +00:00
Andrew Champion 1f92c562bc Support 32-bit rgb and rgba decoding 2019-12-10 20:18:51 +00:00
Andrew Champion fca4e1f88a Support 32-bit grayscale decoding 2019-12-10 20:18:23 +00:00
HeroicKatora ff574b4ca2 Merge pull request #64 from image-rs/release-0.4
Document changes for release 0.4
v0.4,0
2019-11-23 19:43:33 +01:00
HeroicKatora 6f87228458 Merge pull request #65 from image-rs/error-type
Improve the error types
2019-11-21 19:36:38 +01:00
Andreas Molzer 15929f8b8e Document changes for release 0.4
Fixes: #60
2019-11-21 19:23:03 +01:00
Andreas Molzer f13492e41d Fix a doc typo found in PR review 2019-11-21 18:46:55 +01:00
Andreas Molzer 1d9944c5c5 Mark both detailed error types as non-exhaustive
This makes it cheaper to introduce new features that might require
amending the list of variants by allowing us to introduce previously
uncovered causes or more specialized representations.
2019-11-20 20:58:45 +01:00
Andreas Molzer a14b23473b Export the inflate error publicly
It encapsulates the implementation detail of holding a miniz_oxide
status within. The derived traits are not too extensive for other
possible representations as well.
2019-11-20 20:02:55 +01:00
Andreas Molzer 101940335c Fix public constructor from miniz_oxide status
Avoids leaking the dependency on `miniz_oxide` into the public interface
by making a constructor taking a status argument crate internal. It
would otherwise not be possible to replace the deflate decoder without
breaking that interface.
2019-11-20 19:56:13 +01:00
HeroicKatora 8e1c67ee53 Merge pull request #63 from image-rs/tagged
Replace FromPrimitive with our own tag macro
2019-11-12 20:14:25 +01:00
Andreas Molzer 7b672998db Get rid of num-traits crate
Turns out the only use was as a private bound which was unused within
that method.
2019-11-12 20:06:02 +01:00
HeroicKatora 62fee106a7 Merge pull request #62 from onnotechno/multipage_image_patch
Multipage image patch
2019-11-12 13:13:57 +01:00
Onno Kammeraad fd789dc420 Cursor::new(Vec::new()) requires a &mut instead of just & 2019-11-12 13:09:09 +01:00