Skip to content

Commit a10bfab

Browse files
committed
The default value for sample format is an unsigned integer
1 parent b330c6a commit a10bfab

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/imageio/imageio_tiff.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,12 @@ dt_imageio_retval_t dt_imageio_open_tiff(dt_image_t *img, const char *filename,
395395
TIFFGetField(t.tiff, TIFFTAG_PHOTOMETRIC, &photometric);
396396
TIFFGetField(t.tiff, TIFFTAG_INKSET, &inkset);
397397

398+
// Citing the TIFF 6.0 specification for SampleFormat:
399+
// A reader would typically treat an image with “undefined” data as
400+
// if the field were not present (i.e. as unsigned integer data).
401+
if(t.sampleformat == SAMPLEFORMAT_VOID)
402+
t.sampleformat = SAMPLEFORMAT_UINT;
403+
398404
if(inkset == INKSET_CMYK || inkset == INKSET_MULTIINK)
399405
{
400406
dt_print(DT_DEBUG_ALWAYS, "[tiff_open] error: unsupported CMYK (or multi-ink) in '%s'", filename);

0 commit comments

Comments
 (0)