LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert 2d Array to Jpeg using intensity graph color ramp

Solved!
Go to solution

I have a 2d array of some n x m size that I want converted to a jpg with the same resolution (ie, I want the jpg to have n x m pixels). I am displaying this 2d array in an intensity graph. I am currently using flatten pixmap to convert my 2d array to an image and then saving it as a jpg. Unfortunately the colors are not coming out how I want. If I try to use the color table from the intensity graph the colors come out correct, but the wrong values are associated with the colors. I want the color scheme of the jpg to match exactly what I see on screen in the intensity graph, but I want the full resolution of the 2d array.

 

I have attached an example of what I am doing. IntensityGraphColors.vi has an intensity graph showing the 2d array with a particular z-scale color ramp, this vi just takes the 2d array and the color table from the intensity graph and saves it to a jpg. But when I save to a jpg the colors come out different, as shown in test.jpg.

 

Thanks for the help. I tried searching for similar questions but failed to find any solutions that did what I wanted.

Download All
0 Kudos
Message 1 of 5
(3,272 Views)

Why do you want to save with color instead of grayscale?

0 Kudos
Message 2 of 5
(3,251 Views)

Grayscale is fine, but I want to be able set the range at which the grayscale operates. Meaning, I want to be able to say an array value of say 50 is black, and an array value of 600 is white and then have it interpolate the grayscale through that range. I don't want it to just assume 0 is black and 256 is white. I hope that makes sense

0 Kudos
Message 3 of 5
(3,241 Views)
Solution
Accepted by topic author supercheesepuffs

Here is an example going from black to blue to white, which will hopefully point you in the right direction to do whatever you want with the "colors" input.

 

Please note, the colors input is ignored for 24-bit data.

 

 

0 Kudos
Message 4 of 5
(3,234 Views)

Thanks for the help! I've got it working now. Attached is my solution in case anyone else ever needs it

0 Kudos
Message 5 of 5
(3,217 Views)