LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save image from picturebox

Thanks for the reply and the code.  Your vi worked fine on my system.  I guess it must have something to do with the SDK I'm using to get the image and populate the picturebox.  Maybe I am corrupting the picturebox image somehow.

 

I switched my vi to use the same methods as yours and I still got the exception.  When I modified your to save as a jpeg using the same method I am using it worked fine. :robotmad:

 

It seems like the image I am getting from the SDK that says it is a Bitmap class is able to be displayed in the picturebox but is not able to be saved to a file.  If I load your boxes.bmp into the same vi and use the exact same code I can save it no problem.  I guess I'll try playing with the Bitmap object and seeing if I can mold it into something that works.

0 Kudos
Message 21 of 34
(2,703 Views)

smercurio_fc,

 

I'm not familiar with .NET in the least but need the functionality of a webcam snapshot for a test system.  My company does not have the vision module, so I am very interested in this approach.  However, all I get from what we have hacked together and your vi is the 1172 null key error, every time.  I do see that the image is being copied to the clipboard though as I am able to paste it into MS word.

 

Jim

0 Kudos
Message 22 of 34
(2,647 Views)
You'll need to be a bit more specific. What have you hacked together, and which VI are you referring to? There were several VIs discussed in this thead.
0 Kudos
Message 23 of 34
(2,639 Views)

 

I was referring to the one you posted, webcam_fernando_saveas.vi.  We have tried others that are basically the same as yours but always get stuck at the bitmap save node. 

0 Kudos
Message 24 of 34
(2,637 Views)

I'm not sure, but I think the problem may be due to a wiring error in my original example. As I had noted in that reply, I don't have a webcam, so there was no way for me to test the VI. I've attached an updated VI but I have no idea if it will work.

0 Kudos
Message 25 of 34
(2,606 Views)
Thanks for the reply.  I got something to work, it does what I need but only works when I run it directly - when I call it from another vi the image does not update.  Is there  a special way to call .net vis?
0 Kudos
Message 26 of 34
(2,603 Views)
It kind of depends on what you're doing. What is in your subVI? If you're displaying an image on a front panel control, and the subVI is closed, I don't know if the avicap32 library will work properly since it needs a window reference to write the image to.
0 Kudos
Message 27 of 34
(2,597 Views)

smercurio_fc wrote:
It kind of depends on what you're doing. What is in your subVI? If you're displaying an image on a front panel control, and the subVI is closed, I don't know if the avicap32 library will work properly since it needs a window reference to write the image to.

It will and can't work properly. You need to have a valid window for the avicap32.dll to be able to do something. avicap32.dll is the Windows 3.1 way of doing things. It is as such very old and in fact bypassing any modern technology such as DirectX, .Net and whatever by simply plotting directly to the bitmap buffer of the window itself. It is not surprising that the .Net Picture Control box is not aware of that data since what is really happening is that avicap32.dll is simply drawing over the PictureBox instead of into it.

 

Rolf Kalbermatter

Message Edited by rolfk on 08-09-2009 12:16 PM
Rolf Kalbermatter
My Blog
0 Kudos
Message 28 of 34
(2,573 Views)
Thanks for the info, Rolf. I had never heard of that DLL before this thread. Now I know one good reason. Smiley Happy
0 Kudos
Message 29 of 34
(2,564 Views)
0 Kudos
Message 30 of 34
(1,886 Views)