-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SignedByte and SignedShort enum variants #234
Conversation
Add SignedByte(i8) and SignedShort(i16) enum variants to tiff::decoder::ifd::Value.
Ensure that Value::SignedByte and Value::SignedShort to the into_i32, into_i64, into_i32_vec, into_i64_vec methods.
Shouldn't there be more logic to actually handle reading/writing these types? |
Check that an SSHORT (int16) image can be read and written to properly. The minisblack-1c-i16b.tiff image was created using the command `gdal_translate -ot Int16 -co PIXELTYPE=SIGNEDBYTE -scale 0 65536 \-32767 32767 tests/images/minisblack-1c-16b.tiff tests/images/minisblack-1c-i16b.tiff`.
Check that an SBYTE (int8) image can be read and written to properly. The minisblack-1c-i8b.tiff image was created using the command `gdal_translate -ot Int8 -co PIXELTYPE=SIGNEDBYTE -scale 0 255 \-128 128 tests/images/minisblack-1c-8b.tiff tests/images/minisblack-1c-i8b.tiff`.
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 |
Use tiff::decoder::ifd::Value (https://docs.rs/tiff/0.9.1/tiff/decoder/ifd/enum.Value.html) instead of the TagValue enum in src/lowlevel.rs. Note that SignedByte and SignedShort variants are currently commented out, wait for image-rs/image-tiff#234. Also fixed some clippy warnings.
Gentle ping @fintelia to see if this PR looks ok? I'm slowly refactoring the |
Support SignedByte (i8) and SignedShort (i16) types by:
tiff::decoder::ifd::Value::SignedByte
andtiff::decoder::ifd::Value::SignedShort
enum variantsTiffFormatError::SignedByteExpected
andTiffFormatError::SignedShortExpected
enum variantsinto_i8
andinto_i16
methods underimpl Value
insrc/decoder/ifd.rs
Also included two new TIFF files to test roundtrip decoding/encoding:
tests/images/minisblack-1c-i8b.tiff
gdal_translate -ot Int8 -co PIXELTYPE=SIGNEDBYTE -scale 0 255 \-128 128 tests/images/minisblack-1c-8b.tiff tests/images/minisblack-1c-i8b.tiff
tests/images/minisblack-1c-i16b.tiff
gdal_translate -ot Int16 -co PIXELTYPE=SIGNEDBYTE -scale 0 65536 \-32767 32767 tests/images/minisblack-1c-16b.tiff tests/images/minisblack-1c-i16b.tiff
References:
Addresses #204 (comment)