AWARE [SYSTEMS] Imaging expertise for the Delphi developer
TIFF and LibTiff Mailing List Archive

# LibTiff Mailing List

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems

# 2006.09.17 08:49 "Re: alpha in Grayscale or Palette", by Joris Van Damme

```Graeme,

Graeme Gill wrote:
> > challenge here is to somehow involve alpha in that scheme. Is RGBA
> > (20,20,20,20) closest to RGBA (20,20,100,20), or is it closest to
> > RGBA (20,20,20,100)? Put more generally, you need to weigh color
> > difference against alpha difference, and it's not quite clear how
> > to avoid making rather arbitrary weight decisions.
>
> That doesn't seem that difficult. Assume the most sensitive situation
> (ie., against an opaque neutral background), and compute the RGB
> color that would result from that RGBA value. Convert color distance
> to a more visual metric if you like (L*a*b* maybe), and apply the
> usual color quantization algorithms in 4D, rather than 3D (I used to
> like the variance cut that I put in xli).

By applying the arbitrary weight 1, you can effectively hide the fact
that you're applying arbitrary weights, and that's what you seem to be
doing.

As to convertion to Lab, OK, I'm all for that. So now we do indeed have
a 4D space. To make my point, let's encode L, a and b as their natural
float value, and alpha as a float value ranging from 0 to 1. So, you're
saying the difference between L*a*b*alpha (0,0,0,1) (which is
non-transparent black) and (1,0,0,1) (which is non-transparent
almost-black) is equal to the difference between (0,0,0,1) (again
non-transparent black) and (0,0,0,0) (which is total transparency).

See, we apply weights (full transparent range is equally important as a
difference of 1 in the L range). This is obvious if we pick very bad
weights as we did here. So what are good weights? Full transparent range
is equally important as a difference of 100 in the L range? Or is it
twice as important as a difference of 100 in the L range? Why?

Best regards,

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html
```