LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving the Front Panel to a file

Does anyone know how to capture an image of the current frontpanel either to an html or jpeg image programmatically?? Thanks in advance for any help.

ssmith@bnl.gov
0 Kudos
Message 1 of 6
(3,214 Views)
There several ways and here are a couple:
1) for HTML, use the "Print VI To HTML" VI method.
2) for just a jpeg, you can use the "Get Panel Image" VI method and 'Write JPEG File.vi' (as long as you have more than just the base LV package.
The attached picture is from LV6.1, things are a bit different in LV7.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 2 of 6
(3,214 Views)
Donald--
I see how this might work, but because I am a relatively new Labview user there is a lot being left to my imagination. Where in my VI would this reside, inside or outside any loops. I get an error message 7 and don't know what that means. Can you be more specific in using this Print VI to HTML VI method and or GET Panel Image VI method. Thanks.

ssmith@bnl.gov
0 Kudos
Message 3 of 6
(3,214 Views)
'Where in my VI would this reside, inside or outside any loops.'

All depends on what you're trying to do and what kind of program architecture you're using (multiple loops, state machine, events, etc?). I'll make some assumptions and say put the code inside a case structure inside one of your loops. Tie the case structure to logic for whatever it is you want to trigger the creation of the files (boolean button, time of day, etc.)

Attached is really rudimentary demo of Print VI to HTML VI method in LV6.1.
If you haven't already done so, check out the LV examples. "Print LLB to HTML Custom.vi" is pretty close to this.

Side issue:
If you want to know what an error code means/is, right click on the code number in the error c
luster (which you should be religiously using). At the top of the popup menu that appears is 'Explain Error' which when selected will give a little explanation about the error. Error 7 for LabVIEW is 'File not found'.

I easily got Error 7 by deleting the directory c:\HTML test and then running the code in my previous post. Code was telling it to store files there and LV is replying that it's not there.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
Download All
0 Kudos
Message 4 of 6
(3,214 Views)
Hi,

Depending on how you want this to behave (automated or user interaction), you can either put this code inside of an event structure and use the event of a button being pressed to run the code, or you can have it run in order of the dataflow. In LabVIEW, VIs do not run until all of its wired terminals have been passed a value. So, from this you can see that you can control the flow of the program by wiring VIs in a particular order through some common wire (ie, error cluster wire, file path reference, etc). The print VI to html method and Get panel image methods are methods defined within a VI object. It is similar to thinking of it like as an ActiveX Object that has methods and properties. What you see in Donald's code is we are opening
a reference to the current VI, and then invoking the Get Panel Image method to retrieve the image data. Then, we write the image data to a JPG file using the Write to JPG.vi, and then invoke the Print VI to HTML method as well. In order to have a reference to this VI, we are using the Current VI's Path constant, which is found under File I/O >> File Constants. This should give you a little more insight into the code. Feel free to ask more questions if you have them! Thanks!

Jeremy L.
National Instruments
Jeremy L.
National Instruments
0 Kudos
Message 5 of 6
(3,214 Views)
Guys--
Donald's code worked great. I want to thank everyone for the help and speedy responses.

ssmith@bnl.gov
0 Kudos
Message 6 of 6
(3,214 Views)