Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

imwrite: TIFF header TIFFTAG_SAMPLEFORMAT not written

Writing an OpenCV Mat to a TIFF file using imwrite's default settings, I noticed that a standard TIFF tag, TIFFTAG_SAMPLEFORMAT, is not written.

Other header tags, TIFFTAG_IMAGEWIDTH, TIFFTAG_IMAGELENGTH, TIFFTAG_BITSPERSAMPLE, and TIFFTAG_SAMPLESPERPIXEL, are correctly set by OpenCV.

The OpenCV Mat I'm writing has type CV_8UC3, so it seems as though TIFFTAG_SAMPLEFORMAT should be set to SAMPLEFORMAT_UINT.

Why is this tag missing? Is there a simple method to have OpenCV generate this tag as well? I'd like to avoid rewriting this convenient one-liner with a lot of libtiff code, just to get a standard tag.