By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,312 Members | 1,900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,312 IT Pros & Developers. It's quick & easy.

Save image to file from memory

P: n/a
I am using a network camera that saves the image in a byte array in memory
(via their ocx component, and in the OnNewImage event I can get the pointer
to the image and the byte length as
e.lFrmBytes

e.lPtrToImage

How do I get at that array in memory and save it to disk? It seems to
suggest a pointer which is not supported in VB.

-Jerry

Jun 27 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Jerry,

For sure you can use in VB Image.Save, there are no Net classes wich are not
supported in VB for Net

Cor


"Jerry Spence1" <je**********@somewhere.co.ukschreef in bericht
news:NP6dnYOgTbuOmL7VnZ2dnUVZ8q6onZ2d@plusnet...
>I am using a network camera that saves the image in a byte array in memory
(via their ocx component, and in the OnNewImage event I can get the pointer
to the image and the byte length as
e.lFrmBytes

e.lPtrToImage

How do I get at that array in memory and save it to disk? It seems to
suggest a pointer which is not supported in VB.

-Jerry
Jun 27 '08 #2

P: n/a
On May 8, 4:50 pm, "Jerry Spence1" <jerry.spe...@somewhere.co.uk>
wrote:
I am using a network camera that saves the image in a byte array in memory
(via their ocx component, and in the OnNewImage event I can get the pointer
to the image and the byte length as
e.lFrmBytes

e.lPtrToImage

How do I get at that array in memory and save it to disk? It seems to
suggest a pointer which is not supported in VB.

-Jerry
Hi Jerry,
If you're able to copy image to clipboard (memory), you can simply
retrieve it into a picturebox and save by using save method. First
make sure image is copied to clipboard.

' To get image from clipboard
PictureBox1.Image = Clipboard.GetImage

' Then save image with a proper path
PictureBox1.Image.Save("image_path.jpg")

Hope this helps,

Onur
Jun 27 '08 #3

P: n/a
Thanks. My problem is how to get at the memory in the first place. Given the
pointer, how do I read it?

-Jerry
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:96**********************************@m73g2000 hsh.googlegroups.com...
On May 8, 4:50 pm, "Jerry Spence1" <jerry.spe...@somewhere.co.uk>
wrote:
>I am using a network camera that saves the image in a byte array in
memory
(via their ocx component, and in the OnNewImage event I can get the
pointer
to the image and the byte length as
e.lFrmBytes

e.lPtrToImage

How do I get at that array in memory and save it to disk? It seems to
suggest a pointer which is not supported in VB.

-Jerry

Hi Jerry,
If you're able to copy image to clipboard (memory), you can simply
retrieve it into a picturebox and save by using save method. First
make sure image is copied to clipboard.

' To get image from clipboard
PictureBox1.Image = Clipboard.GetImage

' Then save image with a proper path
PictureBox1.Image.Save("image_path.jpg")

Hope this helps,

Onur

Jun 27 '08 #4

P: n/a
I think you'll need to use Windows API calls.

Maybe RtlMoveMemory?

I wouldn't be surprised if VB.NET tries to frustrate you, though. VB.NET
programmers aren't really meant to access memory directly.

--
David Streeter
Synchrotech Software
Sydney Australia
"Jerry Spence1" wrote:
Thanks. My problem is how to get at the memory in the first place. Given the
pointer, how do I read it?

-Jerry
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:96**********************************@m73g2000 hsh.googlegroups.com...
On May 8, 4:50 pm, "Jerry Spence1" <jerry.spe...@somewhere.co.uk>
wrote:
I am using a network camera that saves the image in a byte array in
memory
(via their ocx component, and in the OnNewImage event I can get the
pointer
to the image and the byte length as
e.lFrmBytes

e.lPtrToImage

How do I get at that array in memory and save it to disk? It seems to
suggest a pointer which is not supported in VB.

-Jerry
Hi Jerry,
If you're able to copy image to clipboard (memory), you can simply
retrieve it into a picturebox and save by using save method. First
make sure image is copied to clipboard.

' To get image from clipboard
PictureBox1.Image = Clipboard.GetImage

' Then save image with a proper path
PictureBox1.Image.Save("image_path.jpg")

Hope this helps,

Onur


Jun 27 '08 #5

P: n/a
The namespace Microsoft.Win32.SafeHandles Namespace might also yield a clue.
I don't know anything about this namespace, but it looks promising.
--
David Streeter
Synchrotech Software
Sydney Australia
"SurturZ" wrote:
I think you'll need to use Windows API calls.

Maybe RtlMoveMemory?

I wouldn't be surprised if VB.NET tries to frustrate you, though. VB.NET
programmers aren't really meant to access memory directly.

--
David Streeter
Synchrotech Software
Sydney Australia
"Jerry Spence1" wrote:
Thanks. My problem is how to get at the memory in the first place. Given the
pointer, how do I read it?

-Jerry
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:96**********************************@m73g2000 hsh.googlegroups.com...
On May 8, 4:50 pm, "Jerry Spence1" <jerry.spe...@somewhere.co.uk>
wrote:
>I am using a network camera that saves the image in a byte array in
>memory
>(via their ocx component, and in the OnNewImage event I can get the
>pointer
>to the image and the byte length as
>e.lFrmBytes
>>
>e.lPtrToImage
>>
>How do I get at that array in memory and save it to disk? It seems to
>suggest a pointer which is not supported in VB.
>>
>-Jerry
>
Hi Jerry,
If you're able to copy image to clipboard (memory), you can simply
retrieve it into a picturebox and save by using save method. First
make sure image is copied to clipboard.
>
' To get image from clipboard
PictureBox1.Image = Clipboard.GetImage
>
' Then save image with a proper path
PictureBox1.Image.Save("image_path.jpg")
>
Hope this helps,
>
Onur
Jun 27 '08 #6

P: n/a
Try the System.Runtime.InteropServices.Marshal namespace.

--
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space program."
-- Larry Niven
Jun 27 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.