How to convert char[] buffer into Image?

  • Thread starter Thread starter Gravity
  • Start date Start date
G

Gravity

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.
 
Gravity said:
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?
 
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 said:
Gravity said:
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?
 
Thank you and it work.

Michael Petrotta said:
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));
 
Back
Top