From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

colormaps for a pixmap

There's probably a simple, obvious answer for this, but for the life of me
I can't figure it out.

1. I have a monochrome pixmap.
2. I leave the input for colormap unwired (mostly because I don't really
understand what to do with it ;P)
3. It draws the picture on some ghastly colormap
4. What do I wire to the colormap so that it'll draw it in greyscale.(i'm
using the draw 8-bit pixmap vi), or am i going about this in the completely
wrong manner

Much appreciated,
Jejo Koola
0 Kudos
Message 1 of 2
(3,758 Views)
> 1. I have a monochrome pixmap.
> 2. I leave the input for colormap unwired (mostly because I don't really
> understand what to do with it ;P)
> 3. It draws the picture on some ghastly colormap
> 4. What do I wire to the colormap so that it'll draw it in greyscale.(i'm
> using the draw 8-bit pixmap vi), or am i going about this in the completely
> wrong manner
>

If you have a monochrome, grayscale image, then that is the color table
that you want to provide. The default color table is the default LV
one of a full spectrum 6x6x6 color cube plut some additional grays.

As you said, this can be complicated, but in your case, you want to
provide N grays, where N is how many grays your image has, up to 256.
The simplest way of making them is to make a loop that au
to-indexes
to make an array of colors. Drop a numeric constant and make it
display Hex. Set the control to ffffff (white) and then divide by
N-1 to give you N-1 increments between your N colors. With 256
colors, you divide ffffff by 255 and get 010101 hex as your increment.
In the loop multiply the delta by i and pass it out of the loop.

This general technique works for any two colors, note that white
minus black is ffffff. If you want to ramp from red (ff0000) to
blue(ff), subtract them, divide by N-1, and that's the increment
needed to ramp between them. If you want a multistep ramp, such
as going from green to yellow, to red to white, then decide the
N between these key points, generate and append the different
ramps as long as the total is less than 256 colors.

Note that the ramps we are making here are in RGB coordinate
space. There are other ways of encoding colors, and similar
techniques can be used to ramp between colors in that coordinate
space, and the main change wil
l be the intermediate colors that
are produced. The RGB ramp actually works pretty well in many
cases.

Greg McKaskle
Message 2 of 2
(3,758 Views)