18 lines
496 B
C#
18 lines
496 B
C#
using System.Drawing;
|
|
using System.Drawing.Imaging;
|
|
using System.IO;
|
|
|
|
namespace Inspectron.Camera.Image
|
|
{
|
|
public static class Extensions
|
|
{
|
|
public static ByteImage ToByteImage(this Bitmap self,int channels)
|
|
{
|
|
MemoryStream ms = new MemoryStream();
|
|
var bmp = self;
|
|
bmp.Save(ms, ImageFormat.Bmp);
|
|
ByteImage bi = new ByteImage(bmp.Width, bmp.Height, channels, ms.ToArray(), bmp.Width);
|
|
return bi;
|
|
}
|
|
}
|
|
} |