photopea / UTIF.js

Fast and advanced TIFF decoder
MIT License
426 stars 87 forks source link

missing photometric-tag shows white document #85

Closed ChristHeinrich closed 4 years ago

ChristHeinrich commented 4 years ago

If the Photometric-tag (for color schema) is missing, the whole document is white. Other Libs e.g. tiff.js can display the file correctly.

Example .tif with this tags: Tif_WithoutPhotometric.tif SubFileType (1 Long): Zero ImageWidth (1 Short): 1728 ImageLength (1 Short): 2444 BitsPerSample (1 Short): 1 Compression (1 Short): LZW 65535 (1 Short): 1 StripOffsets (44 Long): 8, 186, 2033, 4899, 8101, 10084, 10673,... SamplesPerPixel (1 Short): 1 RowsPerStrip (1 Long): 56 StripByteCounts (44 Long): 178, 1847, 2866, 3202, 1983, 589, 178, 707,... XResolution (1 Rational): 200 YResolution (1 Rational): 200 ResolutionUnit (1 Short): Inch Predictor (1 Short): 1

photopea commented 4 years ago

Hi, I think that tag must be present in every TIFF file. So your file is corrupted, it does not correspond to the specification.

I think that updating parsers to handle corrupted files is wrong. If we do it, people will care less and less about the specification, and the corrupted files will become a mainstream.

photopea commented 4 years ago

But I can look into it if you share your TIFF file with us.

ChristHeinrich commented 4 years ago

Thank you. Here is the file: CAS_OhnePhotometric.zip

photopea commented 4 years ago

It is fixed too :) although, I have seen a RGB TIFF file also without a PhotometricInterpretation tag. So it is not clear how should be the image interpreted, when this tag is missing.