mathiasbynens / small

Smallest possible syntactically valid files of different types
https://mathiasbynens.be/notes/minimal-html
1.93k stars 184 forks source link

TIFF is not valid #127

Open dc6c opened 2 years ago

dc6c commented 2 years ago

TIFF added in #86 is not entirely valid, and both libtiff and ImageMagick complain about it.

$ tiffinfo tiff.tif
TIFFReadDirectory: Warning, TIFF directory is missing required "StripByteCounts" field, calculating from imagelength.
$ magick identify tiff.tif
identify: TIFF directory is missing required "StripByteCounts" field, calculating from imagelength. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/956.
identify: improper image header `tiff.tif' @ error/tiff.c/ReadTIFFImage/1349.

As I read the standard, it should add the StripByteCounts field, and terminate the IFD with a zero long to indicate no more IFDs.

git-emil commented 1 year ago

This is what ExifTool tells about the 46 byte tiff.tif :

>exiftool -validate tiff.tif
Validate                        : 6 Warnings

When trying to add some meta data:

>exiftool -description=test tiff.tif
Error: No size tag for IFD0:StripOffsets - tiff.tif
    0 image files updated
    1 files weren't updated due to errors
TPS commented 1 year ago

Before the PR in #86, @dmak posted in #85 that these were taken from https://stackoverflow.com/questions/42787235/smallest-possible-valid-tif-file, which hosts some more complaints about the file. Maybe a better source is needed?

dc6c commented 1 year ago

@TPS I don't see any complaints specifically about the 46-byte TIFF in the linked SO question. ??

TPS commented 1 year ago

What I mean is that it gives the vibes of "random guy on the Internet" on a platform that isn't suitable for publishing such. I also can't find anyone else who's even working on such a thing.