On Sun, Jul 16, 2000 at 05:37:56PM +1000, David Hodson wrote:
> OK, this has been bugging me for some time. I'm convinced that Gimp's
> alpha handling is wrong, in more than a few places.

OK, but please provide some concrete examples...

> (Minor disclaimer - I don't have the code in front of me right now, so
> I'm not going back to check details. And I'm not an expert on the Gimp,
> but I do know a fair amount about image processing.)
> To start with, there should be a clear distinction between alpha, which
> is a transparency channel in an image and should always scale the pixel
> colour values; and masks, which serve to select areas of an existing
> image. (Yes, I know not all rgba images are pre-multiplied. They should
> be.)

Can you justify that (all images should be pre-multiplied)?
Or is this just your unsupported opinion?

> At the moment, as far as I can tell, the Gimp cannot handle
> pre-multiplied rgba images. Example: render an rgba image. (I was using
> some PovRay output; I presume it does a reasonable job.)

Gimp has no support for pre-multiplied alpha, and I don't see any reason
to change this because it's just a hack. The Gimp TIFF loader tries its
best to convert pre-multiplied alpha images, but loading TIFFs is an
unending struggle. The format should be put out of its misery ASAP (but
see all previous Gimp discussions on TIFF for reasons why it stills
stalks the earth).

> Now create a flat colour background in the Gimp, lay the rgba image on
> top, and try
> to get a clean composite without black fringing. I don't think it can
> be done, though I'd love to be proven wrong. (There could be issues
> here with different gamma handling between PovRay and the Gimp, but I
> suspect the problem is simply a failure to handle rgba properly.)

If I use an image with real alpha data it works. For your Povray image?
Who knows. Maybe you could send me some sample images off-list and I
will look at them. Povray may be broken, the file output for your
chosen format in Povray may be broken, Gimp's file loader may be
broken, and finally most unlikely you may have a broken Gimp version.

For best results, as always, send me a test image (or two) and another
image in a well-understood format like JPEG which shows approximately
what's intended, as well as any text description.

> At the same time, much of the code for handling alpha data seems to
> unscale and rescale the colour channels. This may be necessary for
> colour manipulations on pre-scaled rgba images, but for anything else
> (transforms, blurs etc.) it is unnecessary for either alpha or masks.
> Example: take the example above, but rotate the rgba image first. The
> result is fairly ugly.

Haven't looked at this, perhaps someone who owns the transforms can


Reply via email to