Hi Don,
I converted from 24-bit png to 8-bit png with MS Paint. If you need to do it programmatically, however, you can <a href="http://www.imagemagick.org/script/binary-releases.php#windows" target="_blank">download</a> and install <a href="http://www.imagemagick.org/script/index.php" target="_blank">ImageMagick</a> ( Note: Make sure you select a Q8 version
or the conversion process won't work correctly). ImageMagick allows us
to manipulate images via the Windows command line. This ability is
crucial because we can then invoke conversion commands using LabVIEW's
System Exec.vi. Refer to the attached example VI, and keep in mind
that this is only one solution. You may be able to find a DLL and use
the Call Library Function Node, or you could even write your own
conversion process with LabVIEW!
To address your second question: you're right. The color information is available somewhere. Each pixel in a 24-bit image is made up of three main colors: Red, G reen, and Blue (the most significant byte is all 0's and represents the alpha channel in 32-bit images). In LabVIEW, the image array within the image data
cluster stores all bytes pertaining to color. Since it's datatype is
U8 (byte size), however, we cannot store 3 bytes of RGB information.
Thus, these values are split across 3 bytes for every pixel. So, in
your particular image, which has a size of 570 x 248 pixels = 161,880
pixels, the image array has a size of 3 * 161880 = 485,640.
What then happens in the Unflatten Pixmap.vi for 24-bit images is that
the RGB bytes are combined to form one 32-bit dword. For example, if a
certain pixel's color is orange (R: 255, G: 128, B: 65), the resultant
value is 255 << 16 + 128 << 8 + 65 = 16,711,680 + 32,768 +
65 = 16,744,513. Therefore, each index of the 24-bit pixmap 2D array
output contains all the information needed to color one pixel.
Finally, the image appears blue on the intensity graph because the
Color to RGB.vi is only returning a value between 0 - 255 on the green
output. Since green is represented in the second byte and blue in the
first, the 00 - FFh value has to map to blue.P.S. What is that (freaky) image of, haha?Message Edited by Pakman on 07-14-2008 02:14 AM
programmatically_convert.vi:
http://forums.ni.com/attachments/ni/170/340421/1/programmatically_convert.vi
test.png:
Loading Image...