There are two different ways to alter a colormap. The first is the change values by hand. This is useful if you want every pixel that is one particular color to be another. For example, if you took a screenshot of a web-page, and you want to make the background a different color, you could re-map the background color to another one.
![]() |
This is used quite often in fields such as medicine and astronomy to generate what are known as false-color images. Different brightness levels are mapped to hues, which is done very easily programmatically. Red might represent hot or high intensity radio signals, while blue and black could represent low intensity signals. When your "image" is just intensity levels, making a false-color image drastically improves readability, because the different hues are easier to see than the different shades of a similar black and white intensity image.