[ptx] nona, gimp-2, TIFF_mask multilater tiff files

Pablo d'Angelo pablo at mathematik.uni-ulm.de
Wed Jan 7 17:54:39 GMT 2004


On Wed, 07 Jan 2004, Pablo d'Angelo wrote:

> I'm downloading gimp-2.0pre1.tar.bz2 at the moment, to see what the tiff
> loader there does. 

This is the alpha handling in gimp2-pre1:

              if (alpha)
                {
                  red_val   = *source++;
                  green_val = *source++;
                  blue_val  = *source++;
                  alpha_val = *source++;
                  red_val   = MIN (red_val, alpha_val);
                  blue_val  = MIN (blue_val, alpha_val);
                  green_val = MIN (green_val, alpha_val);

                  if (alpha_val)
                    {
                      *dest++ = (red_val   * 255) / alpha_val;
                      *dest++ = (green_val * 255) / alpha_val;
                      *dest++ = (blue_val  * 255) / alpha_val;
                    }
                  else
                    {
                      *dest++ = 0;
                      *dest++ = 0;
                      *dest++ = 0;
                    }
                  *dest++ = alpha_val;
                }

obviously we do not want do divide through alpha_val, if the data has not
been premultiplied.

Actually I think all that premultiplying is really bad, because of the
information loss it create. I will never understand why this is the default.
I'd rather like to see the masked content in a viewer that doesn't care
about alpha than crippling the image while saving it!

gimp also writes premultiplied files.. urgh. Should we try to submit a
patch? (sorry, I won't have time to do this).

ciao
  Pablo
--
http://wurm.wohnheim.uni-ulm.de/~redman/
Please use PGP


More information about the ptX mailing list