Hi,

Sorry if this question sound stupid, how do I actually convert a char[]
buffer into Image?

I am currently using C# and compact .net framework for PocketPC development.

Thanks for reading.

Re: How to convert char[] buffer into Image? by Jon

Jon
Thu Jun 02 15:14:02 CDT 2005

Gravity <gravity@nospam.org> wrote:
> Sorry if this question sound stupid, how do I actually convert a char[]
> buffer into Image?
>
> I am currently using C# and compact .net framework for PocketPC development.

Well, a char array is an array of *characters*, which isn't usually a
natural starting place for image conversion.

What's giving you this array of chars in the first place?

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Re: How to convert char[] buffer into Image? by Gravity

Gravity
Thu Jun 02 16:23:18 CDT 2005

Example; Bitmap or JPEG buffer along with header that read from elsewhere,
be it socket, file etc...

And how do I convert the particular buffer in char[] into Image?

Any idea?

"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1d0978e83c370df198c24f@msnews.microsoft.com...
> Gravity <gravity@nospam.org> wrote:
>> Sorry if this question sound stupid, how do I actually convert a char[]
>> buffer into Image?
>>
>> I am currently using C# and compact .net framework for PocketPC
>> development.
>
> Well, a char array is an array of *characters*, which isn't usually a
> natural starting place for image conversion.
>
> What's giving you this array of chars in the first place?
>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too



Re: How to convert char[] buffer into Image? by Michael

Michael
Thu Jun 02 17:01:58 CDT 2005



Gravity wrote:
> Example; Bitmap or JPEG buffer along with header that read from elsewhere,
> be it socket, file etc...
>
> And how do I convert the particular buffer in char[] into Image?
>
> Any idea?

Well, as Jon said, the fact that you've got an array of chars indicates
that something's gone wrong somewhere. You should be getting an array
of bytes, if anything, and remember, a byte is not the same as a char
in .NET. If might help if you indicate exactly how you're getting that
char[].

If you've got a byte[], you can do something like this:

Image i = Image.FromStream(new MemoryStream(myByteArr));


Re: How to convert char[] buffer into Image? by Gravity

Gravity
Fri Jun 03 07:08:10 CDT 2005

Thank you and it work.

"Michael Petrotta" <mpetrotta@gmail.com> wrote in message
news:1117749718.662146.41430@g47g2000cwa.googlegroups.com...
>
>
> Gravity wrote:
>> Example; Bitmap or JPEG buffer along with header that read from
>> elsewhere,
>> be it socket, file etc...
>>
>> And how do I convert the particular buffer in char[] into Image?
>>
>> Any idea?
>
> Well, as Jon said, the fact that you've got an array of chars indicates
> that something's gone wrong somewhere. You should be getting an array
> of bytes, if anything, and remember, a byte is not the same as a char
> in .NET. If might help if you indicate exactly how you're getting that
> char[].
>
> If you've got a byte[], you can do something like this:
>
> Image i = Image.FromStream(new MemoryStream(myByteArr));
>