Closed KnIfER closed 5 years ago
This implementation only works for bits per samples that are divisible by full bytes. Black and white single bits per sample images are not currently supported.
You could convert the image to color tiffs and then use the library in its current form.
Example: Rename the following file to abc.tiff
TIFF Image: abc.tiff
-- File Directory --
ImageWidth (256) SHORT (2 bytes) Count: 1 Values: 2169
ImageLength (257) SHORT (2 bytes) Count: 1 Values: 931
BitsPerSample (258) SHORT (2 bytes) Count: 2 Values: [8, 8]
Compression (259) SHORT (2 bytes) Count: 1 Values: 5
PhotometricInterpretation (262) SHORT (2 bytes) Count: 1 Values: 1
FillOrder (266) SHORT (2 bytes) Count: 1 Values: 1
StripOffsets (273) LONG (4 bytes) Count: 1 Values: [8]
Orientation (274) SHORT (2 bytes) Count: 1 Values: 1
SamplesPerPixel (277) SHORT (2 bytes) Count: 1 Values: 2
RowsPerStrip (278) SHORT (2 bytes) Count: 1 Values: 931
StripByteCounts (279) LONG (4 bytes) Count: 1 Values: [52098]
XResolution (282) RATIONAL (8 bytes) Count: 1 Values: [200, 1]
YResolution (283) RATIONAL (8 bytes) Count: 1 Values: [200, 1]
PlanarConfiguration (284) SHORT (2 bytes) Count: 1 Values: 1
ResolutionUnit (296) SHORT (2 bytes) Count: 1 Values: 2
PageNumber (297) SHORT (2 bytes) Count: 2 Values: [0, 1]
Predictor (317) SHORT (2 bytes) Count: 1 Values: 2
ExtraSamples (338) SHORT (2 bytes) Count: 1 Values: [2]
-- Rasters --
Width: 2169 Height: 931 Number of Pixels: 2019339 Samples Per Pixel: 2 Bits Per Sample: [8, 8]
Pixel x = 0, y = 0: [0, 255] Pixel x = 1084, y = 465: [0, 0] Pixel x = 2168, y = 930: [0, 0]
@bosborn I have just found another pure java library , apache common imaging , although like imageIO, It can't be used on android directly. But after removing and replacing lots of code ( use bitmap instead of bufferedimage ), It's working now! It's capble of loading such tiff images (multiple pixels in one byte, T6 compression) .
Could you add support for the tiff image below ? It's black and white, and thus very small.
Version Information:
Steps to Reproduce:
console log:
Test Files:
more_samples (first 8)