LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting picture to pixmap?

Hi,

In LV 5.1, I can convert a pixmap to a picture,

OR a

pixmap to a graphics file

OR a

graphics file to a pixmap.


....so...

how do I convert a picture to a pixmap??

-Angelo
0 Kudos
Message 1 of 5
(3,984 Views)
I've come across the same problem you have, and the only (altough not very nice solution) is to write a subvi with the picture as input (and only the picture visable on the front panel!), set the picture draw area to show the entire picture and next use the invoke node "Get panel image" with only visable area set to "False". This creates a flattened pixmap wich you can use as input for the write to *.jpg, *.png or *.bmp vi's.

There is however one catch. The front panel has to be activated (shown) for a brief period of time, since otherwise the picture won't redraw the data. The size of the front panel is however not important, so I briefly open the front panel in a very tiny format somewhere at the bottom of the screen, so the user never notices that the screen was
briefly active.


I know this method is not very nice, but since there seems to be no other way to convert the picture to flattened data it is (for now) the only solution I can think of.


I hope I've helped you with this information,


Marcel Kalf
Message 2 of 5
(3,983 Views)
I don't know if this exactly applies to labview 5.1, but in labview 6.1 there is a slightly better way.

For _any_ control you can right click on it and select "Create Reference", then wire this reference to a "Application Control/Invoke Node" VI. Then right click on methods and select "Get Image". Then the method returns the pixmap as an array of numbers and a color table. Presto!

You can make this into its own subVI (remembering to use image properties to resize the picture to full size before you get its image) and avoid having to actually open the window which involves a lot of CPU overhead.

I hope it works in the labview version you have.

Micah
0 Kudos
Message 3 of 5
(3,983 Views)
I too face the same issue. i am on 6.1 and the get image refrence node also fetches the image data along with the label and boundry. please advise.

Ankur
0 Kudos
Message 4 of 5
(3,958 Views)
The "Get Image" invoke node will capture everything associated with a control that is marked as visible. For example, if a label is showing and you do not want the label in your image, then you should hide it. You can hide/show control features by right-clicking the control, selecting "Visible Items", and then checking/unchecking features that you do or do not want to be visible. Any changes will be reflected in your image when it is recreated. To eliminate any "border", cut away any visible features that prevent the control from being rectangular. Hope this helps!

Eric S.
Applications Engineer
National Instruments
E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 5 of 5
(3,935 Views)