LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone know how to change a 24-bit bitmap to an 8-bit bitmap in LabVIEW?

One thing I'm pretty sure about is that Argon does not want to convert to a grey level image : in a previous thread, I proposed an elementary conversion to 8 bits grey, and I got no reaction, except this new thread 😉

The conversion from 24 bits RGB to 8 bits could use a standard palette containing a limited number of colours. One of the simplest palette is the web color palette, composed of all possible combinations of 6 RGB levels, with equidistant hexadecimal values ($00, $33, $66, $99, $CC (I love that one) and $FF. That gives 6x6x6 = 216 combinations. There is even some room for some specific colors ! The coding is a simple search for the nearest color level.
Of course that is not optimal. Depending on the image to be coded, that could led to awfull results. Image for instance a snowy landscape. Here all the color shades should be in the upper values of R,G and B, just to create enough variations of light grey levels.
But that could be a start...
Chilly Charly    (aka CC)
0 Kudos
Message 11 of 15
(1,671 Views)
Open the bitmap image in Paint. Save it as a new bitmap with 256 color format. Open both images inside labview and look at the raw pixel array to see what has changed. Maybe you can get a formula derived from the results.
0 Kudos
Message 12 of 15
(1,669 Views)
There is a quick and dirty way of doing that (24 bit --> 8 bit) in LV (wont be fast, wont be pretty, but it should work). Plot you image a picture control (as 24 bit); then use the method get image from control and get the image as and 8 -bits. This way LV do all the work (of converting 24 bit to 8 bit) for you.

PJM


  


vipm.io | jki.net

Message 13 of 15
(1,654 Views)
Thank you EVERYBODY for your help. Your support really helped me with my project.
Message 14 of 15
(1,646 Views)
What you want to look into most likely is using a routine to create an adaptive palette. Also called an optimized palette. Look those terms up and you'll get plenty of information. While I don't know of anything native to LabVIEW, there are tools out there already that will do this for you. With other people's tools you can either run them externally or adapt their source code into your LabVIEW program (somewhat painful sometimes but it does work). Below is the link to an article on palette optimization with links to some older open source stuff that may get you started if you want to take one of those routes.

http://gradha.sdf-eu.org/palopt/palopt.html
Message 15 of 15
(1,634 Views)