LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save Intensity Graph as Bitmap - but JUST the image

Hi, I've got an intensity graph that I'd like to save as a BMP file. I can save the whole indicator with scales and boundary etc (see attached VI - LabView 6i), but I can't find a way to save ONLY the image I've created on the intensity graph. Suggestions anyone? Richard
0 Kudos
Message 1 of 10
(5,418 Views)
Well, since you already able to get the image of the control, I assume you use the vi server to do this. Notice that the VI Get Control Image returns several values, image, color and bounds. YOu can sent these output to an image control where you can "extract" the region you want to save (this is where the bounds comes in). Hope this helpful.

Joe
Roush Industries, Inc
Message 2 of 10
(5,418 Views)
Thanks Joe. I right-click on the indicator in the diagram, select "Create"-"Invoke Node". Then right-click on the new node, select "Methods"-"Get Image". Then I pass most of the parameters to a save BMP file VI (see VI attached to original post). But how do I select a region from the image? It's the missing link which extracts the IMAGE part of the Intensity Graph (the part that I filled in with my data) that I’m not sure about. How can I use an image control to do this? I wonder if you or someone else would be kind enough to change my very simple VI to suit this need... Very many thanks, Richard.
0 Kudos
Message 3 of 10
(5,418 Views)
ok, see the attached file. remeber, if the file exist, labview (Save BMP File.vi) won't overwrite it.

Joe
0 Kudos
Message 4 of 10
(5,418 Views)
Joe, Thanks a lot. That's been really helpful. It's almost exactly what I wanted and pushed me to my solution and covered a little extra for a relative newby and infrequent LabView user. I've attached my solution just in case anyone else has a similar problem in the future. My case works for intensity graphs and excludes the parts I don’t need (but which helped to explain operation). I think the key trick I missed was to use the Caption to locate the picture in the Intensity Graph which has to be placed very carefully. I can't find any other way to locate my ‘picture’ programmatically. Thanks again. Richard.
0 Kudos
Message 5 of 10
(5,418 Views)
> Well, since you already able to get the image of the control, I assume
> you use the vi server to do this. Notice that the VI Get Control
> Image returns several values, image, color and bounds. YOu can sent
> these output to an image control where you can "extract" the region
> you want to save (this is where the bounds comes in). Hope this
> helpful.
>

One way to subset the image is to copy the intensity graph, place it in
a subVI and connect to the connector pane so that you can easily pass
the data into the subVI and display there. Now use the VI Server to get
the panel image. You can shrink the panel down to only show the
intensity graph or the portion of the graph that you want in the image.
The invoke node has an option to get th
e image of just the visible
part of the entire panel. Obviously you want just the visible portion.

Greg McKaskle
0 Kudos
Message 9 of 10
(5,418 Views)
I tried your program and set the bounds as suggested in the other answer. Maybe it's just me, but it scrambled the image when I did it.

You can hide everything but the plot, and make the plot take up the whole area. In this way you get just the data, with a small grey border. If you need to show the scale info on the VI panel, then just use a second plot off screen for the image grab.

Hope this helps,
Bill Kemmerer
0 Kudos
Message 6 of 10
(5,418 Views)
,

I think that there is one option that needs to be explored, and perhaps some of the brilliant LabVIEW developers can help you/me with this:

A bitmap image is merely a 2D array (I think) containing values according to the format. An intesity graph is gleened from such data as well. I don't see why it isn't possible to save the data sent to an intensity graph to a bitmap format. However; I do not know the proper format of a bitmap file in order to do this.

There is a person at my company that has expertise in this exact idea, but I don't think he would have the time to show anyone his secrets (unless he was paid) but nevertheless, I can try to get something from him on the matter.

Alternatively, if someone at NI is listening, perhaps the guy
s at NI could be so kind as to provide some tools, in the future, for translating graphs directly to bitmap files (since the data are already available).

All that fancy, yet highly effective nonsense aside, here is something else that can be tried, and again, if the NI guys are listening, perhaps they can include such a utility as proposed below in future releases: If you know where your graph is within a window (including borders), you can use WinAPI to capture the bitmap of the window, and then programmatically cut the portion out of the window that you need, and save the bitmap as a file. I have never heard of or seen any tools for doing this, but know that it must be available somewhere.

Good luck
0 Kudos
Message 7 of 10
(5,418 Views)
.

On the Graphics Formats palette, use "Flatten Pixmap.vi" that convert a 2D array of colors to flattened image data. Then use "Write BMP File.vi" to save the image in BMP format. Color Table input may be left empty for 24bits colors.

.


LabVIEW, C'est LabVIEW

0 Kudos
Message 8 of 10
(5,417 Views)

I also met the same problem today but finally solved it.

The idea comes from the LabVIEW context help

Hope this could help someone...

2.PNG

 

1.PNG

 

Message 10 of 10
(3,483 Views)