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

Re: Save image to file from memory by Cor

Cor
Thu May 08 10:55:47 CDT 2008

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" <jerry.spence@somewhere.co.uk> schreef 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
>
>
>


Re: Save image to file from memory by kimiraikkonen

kimiraikkonen
Thu May 08 11:24:33 CDT 2008

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

Re: Save image to file from memory by Jerry

Jerry
Thu May 08 16:11:25 CDT 2008

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

-Jerry


"kimiraikkonen" <kimiraikkonen85@gmail.com> wrote in message
news:96a98ce9-747d-4d07-ad83-a4d943c36856@m73g2000hsh.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



Re: Save image to file from memory by surturz

surturz
Sun May 11 22:30:04 CDT 2008

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" <kimiraikkonen85@gmail.com> wrote in message
> news:96a98ce9-747d-4d07-ad83-a4d943c36856@m73g2000hsh.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
>
>
>

Re: Save image to file from memory by surturz

surturz
Sun May 11 23:12:01 CDT 2008

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" <kimiraikkonen85@gmail.com> wrote in message
> > news:96a98ce9-747d-4d07-ad83-a4d943c36856@m73g2000hsh.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
> >
> >
> >

Re: Save image to file from memory by Joel

Joel
Mon May 12 13:40:51 CDT 2008

Try the System.Runtime.InteropServices.Marshal namespace.

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