what is a color map and when do I need one?
Asked Answered
E

1

15

Is there any general concept or definition of what is a "color map" within computer graphics? You sometimes stumble upon this term in some libraries - so may I assume that color maps intend to have a specific functionality and purpose?

What exactly do I need a color map for and when do I need that?

Also, are there some resources on this matter - what do I search for?

For complainers about how unspecific this question is: What is the difference between color maps in xlib and giflib?

Excitable answered 19/8, 2014 at 21:24 Comment(4)
This question appears to be off-topic because it doesn't appear to be about programming.Jongjongleur
Why? I put my question in context, definitely. It's about terminology and how a commonly used term is defined by different libraries and even throughout different programming languages. So if this term appears to have a similar meaning. I didn't want to ask what differences there exists between "color map" definitions in xlib, giflib, jpeglib, libtiff, magick or gtk in c libraries because I assume they at least intend to be the same - that's why I asked in general. I think your conclusion is meaningless.Excitable
So what you are saying is that there is no way to assume that a color map used by different gfx libraries in c or other languages could have a similar meaning? So this is just a variable term individually defined by an individual library? There is no concept in a programming language about color maps even if this term is commonly used but there is a general meaning of a color map, which doesn't apply to programming languages at all? So what actually is a color map - I'm not able to find anything in google, but I can find this term in the c-libs.Excitable
You should read the documentation of those libraries or contact the authors and ask them. It's not a programming question so it doesn't belong to SO. (I'm not saying it's a bad question or it's useless, it's just not for SO.)Jongjongleur
K
10

A color map (often called a color table or a palette) is an array of colors used to map pixel data (represented as indexes into the color table) to the actual color values.

Some graphic displays, especially older ones, cannot show an arbitrary color for every pixel. Instead, each pixel is stored as a small number that's used as an index into the color table.

For example, it was common for VGA, in some modes, to be able to display up to 256 unique colors at one time. But since the screen had many more than 256 pixels, you couldn't set an arbitrary RGB value for each of them. Instead, you'd store a single byte per pixel, which would be used to look up the actual color in the color table.

Color tables are less relevant today, but some graphics file formats still represent as a color table and pixel data the consists of indexes into the table, rather than directly encoding the pixels as colors in some colorspace, like RGB. So if you write code to deal directly with these formats, you'll have to understand how color tables work.

If you work in embedded systems, you might encounter a limited display that still uses a color table. Xlib, the Windows API, and other graphics APIs still have functions for dealing with systems that have a limited color table, though I doubt many programmers use them nowadays.

Kelleher answered 20/8, 2014 at 21:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.