Commit Graph
82 Commits
Author SHA1 Message Date
Andrew Champion 959254aee9 Deduplicate encoding tests
Also removes dev dependency on tempfile.
2019-12-21 15:12:25 +00:00
Andrew Champion abd6aee19f Remove outdate and ambiguous TODO (minor) 2019-12-16 22:10:57 +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 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
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
Andreas Molzer 07e8501ad6 Prefer matching over if-else-chain in tags macro
Thanks to the review comment for pointing this style issue out.
2019-11-12 10:53:38 +01:00
Onno Kammeraad 686e9b2648 added a missing offset increase while adding padding 2019-11-11 16:15:01 +01:00
Andreas Molzer 517638a38f Prefer explicit conversion over as
The discriminant of some enum types can be retrieved with the `as`
operator and in C style enums it is also possible to set a specific
discriminant. However, that may silently change—breaking the value
written to the file. It is better to use that technique mostly for ffi
purposes.
2019-11-10 23:20:19 +01:00
Andreas Molzer a6696ab02f fixup! Move everything to the tags macro 2019-11-10 19:24:22 +01:00
Andreas Molzer 258edf4a46 Remove the num-derive dependency 2019-11-10 18:02:43 +01:00
Andreas Molzer f88c9f00c3 Move everything to the tags macro 2019-11-10 18:02:42 +01:00
Andreas Molzer f80f4a06d5 Make the Unknown field optional
Several other uses that currently rely on num-traits for conversion have
no Unknown representation. Thus, the converter now outputs only known
variants or an error and the exposing function then can put the error
value into an Unknown variant instead.
2019-11-10 18:02:08 +01:00
Onno Kammeraad cbae42ea94 fixed support for multipage images, the IDF offset is added during the new and also at the end of the internal_finish. This should only be done once 2019-11-06 14:04:18 +01:00
Onno Kammeraad 80b8ec5cdb Somehow the current offset was invalid when using multipage images. Now using the seek function to get the current offset 2019-11-06 13:58:29 +01:00
Andreas Molzer ffdeb62b9f Rework the tag macro to make it reusable
Factor out parts that are unique to instantiations such as the name, the
documentation, the underlying type, the public conversion methods.

Also adds the ability to document individual items and remodels the
syntax to more closely resemble ordinary enum definitions.
2019-11-01 01:35:18 +01:00
HeroicKatora 6aea7b33c1 Merge pull request #49 from Masterchef365/deflate
Old-style DEFLATE compression support
2019-11-01 00:42:18 +01:00
Masterchef365 f8d4b57120 Change implementation details for InflateError, add uncompressed cap 2019-10-04 18:52:39 -07:00
Masterchef365 6f9f2adfbf Improved error messages for inflate decompression 2019-10-02 21:06:11 -07:00
Masterchef365 205626bd62 Switch to miniz_oxide crate for DEFLATE decompression 2019-10-02 18:51:47 -07:00
Masterchef365 ce73d39d57 Add old-style DEFLATE support 2019-10-02 18:51:07 -07:00
Masterchef365 b79128d766 Add Deflate and OldDeflate compression type recognition 2019-10-02 18:51:07 -07:00
Callum Tolley 3868f78067 Make Limits struct fields publicly accessible 2019-09-22 22:11:24 +01:00
Yuki Okushi ea19f0f686 Remove try! macros 2019-08-29 19:10:27 +09:00
Dustin Thomson 30eb8487a6 Signed value support
Add support for SBYTE, SSHORT, SLONG, SRATIONAL as per the Tiff 6.0 spec
Add support for multiple BYTE
2019-08-14 21:22:56 -06:00
Birk Tjelmeland 514b7cddaa Change minimal rustc version to 1.24.1 2019-05-03 23:12:29 +02:00
Birk Tjelmeland 48f16f5206 Merge pull request #41 from birktj/fix-bugs
Fix divide by zero bug
2019-04-25 22:30:31 +02:00
Andrew Champion 496a2f31cf Convert panic to error for writing wrong size strip 2019-04-25 20:03:30 +02:00
Andrew Champion 334759b08d Remove several panics in write_image
Closes #35.
2019-04-25 20:03:29 +02:00
Birk Tjelmeland 4609425be9 Merge pull request #37 from jimrybarski/master
Allow Decoder::next_image() to be called multiple times to allow paging through a multi-page TIFF
2019-04-25 18:23:06 +02:00
Birk Tjelmeland dbf532b0a9 Fix divide by zero bug
This fixes #33
2019-04-25 14:58:08 +02:00
Atul Bhosale 522fbd1a69 Format code using 'cargo fmt' 2019-04-18 00:04:43 +05:30
Jim Rybarski d314a032de Merge branch 'master' of github.com:PistonDevelopers/image-tiff 2019-03-29 09:47:35 -05:00
Jim Rybarski 198f3ff3dc Allow Decoder::next_image() to be called multiple times to allow paging through a multi-page TIFF 2019-03-28 15:14:44 -05:00
Birk Tjelmeland 5e86931dff Fix possibly overflowing multiplications 2019-03-12 11:07:57 +01:00
Birk Tjelmeland 5c3f50f800 Fix compiler and clippy warnings 2019-02-28 07:58:07 +01:00
Birk Tjelmeland 2ff0934354 Fix infinite loop bug 2019-02-28 07:51:28 +01:00
Birk Tjelmeland bd0d66c09f Fix potential out of bounds array access 2019-02-27 19:45:59 +01:00
Birk Tjelmeland d637e1f7f6 Fix memory exhaustion bug 2019-02-27 16:15:57 +01:00
Jonathan Behrens ff26217534 Merge pull request #26 from birktj/incremental
Incremental decoding implemented
2019-02-26 20:07:29 -05:00