TIFF and LibTiff Mail List Archive


2004.05.21 12:00 "[Tiff] Un-premultiplying the color data", by
2004.05.21 19:30 "[Tiff] Re: Un-premultiplying the color data", by Chris Cox
2004.06.15 11:40 "Re: [Tiff] Quality of service", by Joris

2004.05.21 12:00 "[Tiff] Un-premultiplying the color data", by

Hi chris,

Here is what I am trying in my code to un-premultiply the color data in the image attached with this message:

source: is the buffer returned by the libtiff functions. dest: is the destination buffer the image is: contig, strip, CMYK, 8-bits per channel, with one associated alpha channel

since i have to gather the color values in my dest buffer in the order KCMY, that is why i take dest[0] = source[3] and so on.

alpha = source[4];
if(alpha != 0)

dest[0] = ( (source[3]*255) + alpha/2 )/alpha;
dest[1] = ( (source[0]*255) + alpha/2 )/alpha;
dest[2] = ( (source[1]*255) + alpha/2 )/alpha;
dest[3] = ( (source[2]*255) + alpha/2 )/alpha;


There are two questions here:

  1. How do you know come to know about the color information, if alpha had been zero?
  2. Is the procedure above correct?