2023.04.10 15:23 "[Tiff] CFAREPEATPATTERNDIM and CFAPATTERN", by David C. Partridge

2023.04.10 17:28 "Re: [Tiff] CFAREPEATPATTERNDIM and CFAPATTERN", by Sulau

Hi David

PS could someone please explain how I should interpret the meaning of e.g. TIFF_SETGET_C16_UINT8

You can find a lot of writing and reading examples and hints in test\custom_dir_EXIF_231.c

TIFF_SETGET_C16_UINT8 means that the TIFFSetField() or TIFFGetField() function expects data of a dynamic (length is variable) UINT8 type array. A count parameter has to be provided to TIFFSetField() or TIFFGetField() of type uint16_t ("C16").

For example:

         TIFFSetField(m_tiff, TIFFTAG_CFAPATTERN, 4, TIFF_CFAPattern_BGGR); 
uint16_t  count16;
uint8_t   *pByteArray;
         TIFFGetField(m_tiff, TIFFTAG_CFAPATTERN, &count16, &pByteArray);

count16 returns the number of read uint8_t values (which should be 4 because 4 bytes were written). The data is stored in an uint8_t array pointed to by pByteArray. Be aware, that this LibTIFF internally allocated memory will vanish if you setup / switch to a new IFD or close the file. Thus, you should copy the content into a byte array of your application.

When you want to access EXIF tags, then you have first to switch the EXIF "custom"-IFD. An example is in custom_dir_EXIF_231.c. And see also the LibTIFF documentation e.g. at http://www.simplesystems.org/libtiff/functions/TIFFCustomDirectory.html

Regards
Su