Saving an image and tags as a completely conformant TIFF file
Hi all: I am saving an image using ImageSave and the /WT option, which allows for TIFF tags to be added to the file. Some of the tags I am saving are ASCII and some are auxiliary waves. The resulting TIFF file does not seem to be valid on a Mac, at least: Its icon is a generic picture icon, and if I open it in Mac Preview it gives the error message "The file “scan03.tif” could not be opened. It may be damaged or use a file format that Preview doesn’t recognize." I also tried to validate the file using the program DPF Manager, which is an open-source project that validates TIFF files. I received two kinds of errors:
1. "ASCII strings must terminate with NUL." This is evidently part of the TIFF specification, but as far as I can tell Igor does not add the required NULL character after the string. I tried putting "\x00" after my string, but Igor exported this literally, not as a NULL character.
2. "Bad word alignment in offset." Evidently TIFF files are supposed to have their tags word-aligned, instead of byte-aligned. After doing some reading this seems to be ignored by most TIFF readers, so maybe it's OK.
3. "NewSubfileType Tag type is not valid, a LONG type is expected." This tag seems to be automatically added by Igor as it's probably needed for any valid TIFF file. However, the length of this tag is one byte ("SHORT") whereas the TIFF spec says it should be LONG. However, DPF manager goes on to say, "NewSubfileType Tag type is not valid, but it is compatible." so maybe this is not the problem.
Anyway, has anyone else had these sorts of issues? Is there a way to add the trailing NULL and/or do the word alignment?
If you are having trouble saving a TIFF file with your own tags please send an email to support@wavemetrics.com and include information about the version of Igor that you are using, the platform you are running on and an experiment or procedure that reproduces the problem.
October 26, 2021 at 08:15 am - Permalink