• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Post reply

Other options

Shortcuts: ALT+S save/post or ALT+P preview

Topic summary

Posted by Galfar
 - 28 May 2008, 23:08:05
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.
Posted by Max Nilson
 - 28 May 2008, 09:29:24
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.
SMF spam blocked by CleanTalk