[Haskell-cafe] Mini-announce: AC-Color 1.1.3

Yitzchak Gale gale at sefer.org
Tue Mar 9 07:37:19 EST 2010


Andrew Coppin wrote:
> I just uploaded a new version of the AC-Colour package...

Thanks for this.

Your algorithm for scaling brightness is not correct however.
The RGB values in all popular image formats are not linear.
They use a gamma transfer function. So your algorithm
will indeed change the colors in an image, not just its
brightness. In some cases the change in color can be quite
drastic. For a long-winded explanation and many examples,
see:

http://www.4p8.com/eric.brasseur/gamma.html

You may want to implement one of the popular gamma transfer
functions, such as BT.709 or sRGB. The former may also be
useful for your AC-PPM package, since the PPM image format
uses it, as specified in its documentation:

http://netpbm.sourceforge.net/doc/ppm.html

sRGB is used in most other popular image formats
on the web nowadays.

> Colour maps. Give it some control points, and it'll
> (linearly) interpolate between them

Your algorithm for this is actually not linear at all, since RGB
values are generally not linear, as above.

Regards,
Yitz


More information about the Haskell-Cafe mailing list