LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does the "get image" method of the picture control remap my color table?

I am using labview 6.0.2 without IMAQ. I have read an image from disk and have modified it; it looks OK in a picture indicator. I want to save the image, so I use the picture indicator's "get image" method to flatten the data and provide it to the "write jpeg file" subvi. This works, but the colors are remapped. They were 256-bit, but now they look like 4-bit. Why is this happening, and how can I get around it?
0 Kudos
Message 1 of 7
(3,602 Views)
When using the Get Image method, you must connect the image depth input with the number of bits per pixel (256 sounds like a bit much - 256 colour maybe?) and you must connect the same number to the Write JPEG File VI. The default number in both cases is very low. Give that a try. I have not had any difficulties using this method for plotting spectrum analyzer trace data.
0 Kudos
Message 2 of 7
(3,598 Views)
Rob,

Thanks for your response. I forgot to mention that I do have the color depth wired appropriately. I did mean 8-bit when I said 256-bit! Oops. As a test I verified that the color table coming from the "get image" method was in fact 256 members long (It was). So I graphed the original color table against the new color table. The original table looks like noise, but the new table looks like a stepped ramp. There are still 256 values in the new table, but only a handful are unique.
0 Kudos
Message 3 of 7
(3,598 Views)
Sounds like you are getting the default table and not your original. I would delete all of the connections to the JPEG vi and rewire them (I have had strange occurances in the past with wiring). I'm not saying that you wired them wrong, just that I've found times when a wire looks good but was losing data (NI couldn't account for it either). I'll have to try something with an unusual colour map and see what happens.
0 Kudos
Message 6 of 7
(3,598 Views)
Hi,

the Jpeg compression algorithm doesn't work fine if you set the pixel depth to 8. When you save your picture set it to 24, everything should be ok.
See attached example vi.
Good luck,
Alberto
Message 4 of 7
(3,598 Views)
Alberto,
Thanks for your answer, all i had to do was set the depth to 24 when using the "get image" method and "write to jpeg" vi and all was well! I guess the "get image" method is buggy, or the documentation is not that great. I suppose that the "depth" parameter is actually the depth of the computer's graphic subsystem, _not_ the depth of the image. Labview handling of images seems rather clumsy in that it seems to be accessing the screen memory directly instead of a buffer containing the image information.
0 Kudos
Message 5 of 7
(3,598 Views)

Anybody knows why, when i get image to print on report, i obtain different results with different resolution?

when i have screensize of 1280x1024 the image get outs a little bit larger than the one from 1024x768, but only on the printer, (and only witha standalone .exe file, not on my developing pc).

Thankyou

 

Steve.

0 Kudos
Message 7 of 7
(3,318 Views)