LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do you change the capture dimensions in the Get Panel Image VI

My objective is to capture the front panel image to a JPEG file. I want to be able to alter the dimensions of Front Panel Image so I can exclude certain areas of the front panel. I am using the GET PANEL IMAGE.VI and the WRITE JPEG FILE.VI. I have tried using a Cluster structure from the bounds property of the GET PANEL IMAGE.VI to feed into the "rect" property of the WRITE JPEG FILE.vi however as soon as I alter the dimensions from the original dimensions it fails to save the panel image to file. Is this actually possible, or does LabVIEW restrict users from altering the panel capture dimensions? Or is this a known bug in LabVIEW v6.0?
0 Kudos
Message 1 of 5
(3,120 Views)
The only way I know to do this is to hardcode the "bounds" (normally comes out of Get Panel Image, called "rect" going into the write JPEG File VI). Otherwise, you're either going to get the entire front panel, or you can select the "viewable area only" and just get the part that you can see on the screen. (Front panel may have objects outside the screen size)

Mark
0 Kudos
Message 2 of 5
(3,120 Views)
Hi,

Here is a zip file containing two VIs.

'Change Control Value.vi' when run will load the VI 'Demo.vi'. It will alter its size and the run demo.vi.

On the front panel or demo.vi, press the Update button and the image will be written to c:\temp.


All a bit crude but the mechanism works in labview 5.1.1. (Unfortunately I haven't got version 6.0.2 installed yet.)

Regards
Ray.
Regards
Ray Farmer
0 Kudos
Message 3 of 5
(3,120 Views)
Hi Rob,

This is not a bug.
Your main problem is that you resize the image margins without resizing the flattened image data array.
I attach a vi that does what you ask.
You can set the portion of your front panel image to save on disk.
I did not connect a vi reference, in this way it acts on the actual vi, but this can obviously changed.
In my example I used 8-bit pixel depth, you can easily change it to 24, remember in this case to connect the proper terminals on the functions.

Good luck,

Alberto Locatelli
Message 4 of 5
(3,120 Views)
Answer was spot on - problem solved. Thanks Alberto.
0 Kudos
Message 5 of 5
(3,120 Views)