Just has our in house support throw this file my way. Turns out that there is 7 directories in the TIFF file and one of them (the 4th) is grey scale with an alpha channel, and the code in TTiffFileFormat.LoadData, line 327 that reads
if Info.ChannelCount > 1 then
SwapChannels(Images[Idx], ChannelRed, ChannelBlue);
tries to swap non existent red and blues channels. Interestingly enough the comment above the definitions for ChannerlBlue/Red/Green/Alpha mentions that these can only be used for ARGB images, but in this case there is no checking that the TIFF directory has an ARGB image format, it makes the assumption based on number of channels.
I also note that the saving code forther down in the source makes the same assumption that more than 1 channel implies that there are RGB channels available. So any fixes needs to be handled in both places in the code.
I'm going to hack my source to work for now, but I'm not familiar with the code base to make a correct determination on which ImageFormat types that the channels should be swapped.
Cheers, Max.
Thanks for reporting this bug!
Correct if condition in loading function should be
if (Photometric = PHOTOMETRIC_RGB) or (DataFormat = ifUnknown) then
SwapChannels(Images[Idx], ChannelRed, ChannelBlue);
to swap only RGB images and images got from TiffLib RGBA interface (ifUnknown format).
Saving is the same but without the DataFormat check.
I'll update SVN repository with this fix in few hours.