image-rs / image-tiff

TIFF decoding and encoding library in pure Rust
MIT License
121 stars 79 forks source link

Add SignedByte and SignedShort enum variants #234

Closed weiji14 closed 4 months ago

weiji14 commented 6 months ago

Support SignedByte (i8) and SignedShort (i16) types by:

Also included two new TIFF files to test roundtrip decoding/encoding:

References:

Addresses https://github.com/image-rs/image-tiff/issues/204#issuecomment-1708003609

fintelia commented 5 months ago

Shouldn't there be more logic to actually handle reading/writing these types?

weiji14 commented 5 months ago

Shouldn't there be more logic to actually handle reading/writing these types?

I've added a couple of roundtrip tests to check reading/writing SByte and SShort TIFFs, see if that looks ok.

Btw, I looked under https://github.com/libsdl-org/libtiff/tree/v4.6.0/test/images and couldn't find any obvious example TIFF files of int8/int16 types, so I just converted the uint8/uint16 tiffs using gdal_translate with some scaling. Happy to exchange those to better samples if needed.

weiji14 commented 4 months ago

Gentle ping @fintelia to see if this PR looks ok? I'm slowly refactoring the geotiff crate downstream to rely on image-tiff's enums, and it would be nice to have this PR wrapped up so that I can continue with https://github.com/georust/geotiff/pull/15.