Tinkr2/4.2/AphelionCore/AphelionCore/Core/Core.cs
/// <summary>
/// Returns a Bitmap from raw file bytes.
/// </summary>
/// <param name="data">Bytes to convert into Bitmap.</param>
/// <returns>Returns the <see cref="Bitmap"/> created from data.</returns>
Returns a Bitmap from raw file bytes.
Returns a Bitmap from raw file bytes .
public static Bitmap ImageFromBytes(byte[] data)
      {
         if (data[0] == 0xFF && data[1] == 0xD8)
         {
            return new Bitmap(data, Bitmap.BitmapImageType.Jpeg);
         }
         if (data[0] == 0x42 && data[1] == 0x4D)
         {
            return new Bitmap(data, Bitmap.BitmapImageType.Bmp);
         }
         if (data[0] == 0x47 && data[1] == 0x49 && data[2] == 0x46 && data[3] == 0x38)
         {
            return new Bitmap(data, Bitmap.BitmapImageType.Gif);
         }
         return null;
      }
public static Bitmap ImageFromBytes ( byte [ ] data ) { if ( data [ 0 ] == 0xFF && data [ 1 ] == 0xD8 ) { return new Bitmap ( data , Bitmap . BitmapImageType . Jpeg ) ; } if ( data [ 0 ] == 0x42 && data [ 1 ] == 0x4D ) { return new Bitmap ( data , Bitmap . BitmapImageType . Bmp ) ; } if ( data [ 0 ] == 0x47 && data [ 1 ] == 0x49 && data [ 2 ] == 0x46 && data [ 3 ] == 0x38 ) { return new Bitmap ( data , Bitmap . BitmapImageType . Gif ) ; } return null ; }
Returns a Bitmap from raw file bytes.
Returns a Bitmap from raw file bytes .
// JPEG // BMP // GIF // Unsupported Image Type
Returns the  created from data.
Returns the created from data .
data
byte[]
Bytes to convert into Bitmap.
Bytes to convert into Bitmap .