Search code examples
c#.netimagemonosystem.drawing

Convert a byte array into an image w/o FromStream (for Mono)


I am trying to find a way, in C#, to convert a byte array to an Image without using Image.FromStream.

I would like a conversion routine that can be used in Windows as well as Linux, and I am using Mono to interpret the code. Analyzing the code (with the Image.FromStream) using MonoTools 2.0 reports that FromStream is not supported.

Is there a more manual, so-to-speak, way of getting the data into the Image object? I imagine I need to use FromHbitmap somehow by creating a handle to the byte array?


Solution

  • Image.FromStream is supported (and has been supported for a long time) in Mono and works without any problems. If MoMA is reporting problems - are you sure you are using a current definition file (they hadn't been updated for the latest release, but a plain 2.10 should also show you "supported").