[Qgis-developer] 8-bit colour ramps?

Etienne Tourigny etourigny.dev at gmail.com
Thu Aug 9 10:38:44 PDT 2012


Hi,

actually #abcdef is 24 bits, but every color channel is 8 bits only
(0-255). The author mixes up a few concepts, because when you have
8-bit color channels you have an 24-bit palette. The author is trying
to refer to deep-color (30/36/48-bit) RGB colors which offer a wider
spectrum of colors.

My understanding of the code is that any interpolated colors are
created using integer values, which result in 8-bit colors channels
and a 24-bit palette, so the statements in that link are probably
correct.
However, raster shading calculation uses double precision for the
computation, but converts the result to integer before creating the
color. Vector interpolation uses integers exclusively.

I'm not sure if QColor supports 16-bit color channels, but offers a
means to store the color in 16-bit precision.

This could be improved in both cases,  by using QColor::getRgbF() and
QColor::setRgbF QColor::setRgbF - these use double values in the 0.0 -
1.0 range instead of 0 - 256 range.

However, I don`t have an actual example to illustrate the difference
in palette and I'm not sure it would make such a difference - but it
might in high-quality reprints.

According to [1] -   256 (32-bit) shades of red, green, and blue, for
a total of at least 16,777,216 color variations. The human eye is
capable of discriminating among as many as ten million colors to the
naked eye.

[1] http://en.wikipedia.org/wiki/Color_depth
[2] http://qt-project.org/doc/qt-4.8/QColor.html

Etienne

On Thu, Aug 9, 2012 at 12:04 PM, Barry Rowlingson
<b.rowlingson at lancaster.ac.uk> wrote:
> Someone on gis.stackexchange.com:
>
> http://gis.stackexchange.com/questions/29357/how-to-improve-the-display-of-color-images
>
> says, about colour ramps:
>
> "
>  but in ArcGIS and QGIS, they don't seem to be easily usable for a
> finished product because their complexity causes obvious steps rather
> than a smooth gradient. The raster renderer appears to be stuck at an
> 8-bit palette (only 256 levels), rather than a mathematical transform
> involving 24-bit standard RGB or deep 48-bit RGB.
> "
>
>  huh? I'm pretty sure the colours in the raster colour map dialog are
> 24 bit (#abcdef looks like 24 bits to me) so what are they on about?
>
>  Anyone want to authoritatively respond on the site? The poster has
> already accepted an answer claiming they can do it with ArcGIS...
>
> Barry
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list