LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save vi to jpg without displaying vi

So I have a vi that takes in a file and displays it on a graph, with all sorts of fancy options on it. One of those options is to save the graph to a jpg. When you go to save it as a jpg, it opens another vi with a special layout and sets up all sorts of text on the front panel of this subvi. Then it saves the front panel to a jpeg.

I have another vi that is a batching program for my graphing vi. This vi takes in a directory of files, and then background loads the graphing vi, and proceeds to queue up commands and graph the files and save them. The graphing vi is set up so that when you save to jpg while batching, it does not load the front panel. This is done because if you're processing a huge list of files, you don't need a vi popping up a bunch of times.

My problem is that if I don't pop the front panel of the save subvi, it doesn't draw the graph, and so even though it updates all the text and graph information (axis names and stuff like that), it doesn't draw the graph because I don't display it. Is there a way to get LabView to draw this graph without popping the front panel?

The main reason I want to solve this is that the batching program actually handles several different kinds of graphing (I'm building it modularly so I'm solving this one vi at a time), and in the end I don't want several windows popping up every time I save a graph, per file batched.

Thanks!
0 Kudos
Message 1 of 8
(3,432 Views)
What function are you using to save to .jpg? Is it possible to run your save to .jpg VI minimized, so it still gets updated, but doesn't pop up?

Interesting problem!
0 Kudos
Message 2 of 8
(3,430 Views)
I'm seeing the same thing you are...

I made 2 VI's:
"SendDatatoSubVI" creates an array of random data, and passes that data and a string to "FP-to-Image1"
"FP-to-Image1" plots the data on a graph, and saves the front panel image to a .jpg file.

If "FP-to-Image1" is in memory (but not necessarily open), the .jpg file saved has the data on the graph. If I close both VI's, then open just "SendDatatoSubVI" then the first time it is run, there is no data the graph. I have seen 2 ways to make it work every time:

Option A) In the sub-vi's Window Appearance property, set the "Window runs transparently to 100%"
Option B) In the sub-vi't Window Run-time Position property, set Position to "Minimized"

In the main VI, be sure to set the SubVI Node Setup to "Show front panel when called" and "Close afterwards if originally closed"

I'm using LabVIEW 8.5.




Message Edited by LabViewGuruWannabe on 01-16-2008 07:15 PM

Message Edited by LabViewGuruWannabe on 01-16-2008 07:16 PM

Message Edited by LabViewGuruWannabe on 01-16-2008 07:16 PM

Message Edited by LabViewGuruWannabe on 01-16-2008 07:19 PM
Download All
0 Kudos
Message 3 of 8
(3,418 Views)
I found a third option after pocky around with LabViewGuru's example vis.

If you call a property that loads the front panel into memory (like gettings a reference to the front panel) before you make the subvi call, then it'll work. The FP.Get Image command also loads the front panel which is way running SendDatatoSubVI works the second time. The relavent front panels objects don't seem to have their display updated unless there value is changed after their front panel has been brought into memory or you open the front panel.

Matt W
Download All
0 Kudos
Message 4 of 8
(3,407 Views)
I'm using an Invoke Node with FP.Get Image to grab the image, and I'm taking the Image data and drawing it on a picture in my save VI, then I'm taking that picture and using another Invoke Node with FP. Get Image to grab that data and save it to a jpeg. It's a bit roundabout but it tends to work.
0 Kudos
Message 5 of 8
(3,404 Views)
If you set the front panel state to hidden it should work.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 8
(3,391 Views)
Grabbing a reference to the front panel of the vi, without opening it, seems to have done the trick.

Thanks Matt!
0 Kudos
Message 7 of 8
(3,364 Views)
You should note that if you are planning to build this into an executable, you have to include the FP of the VI in the build. The easiest way to do that is to create a property node for one of the controls on the FP, but you can also change it explicitly when you build the application. It's possible that the invoke node you used will also work for that.

___________________
Try to take over the world!
Message 8 of 8
(3,343 Views)