Save As Bitmap - CSharp System.Drawing

CSharp examples for System.Drawing:Image Convert

Description

Save As Bitmap

Demo Code

// Copyright (C) 2012-2014 Daiyuu Nobori. All Rights Reserved.
using System.Runtime.InteropServices;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Net;
using System.Web.Mail;
using System.Diagnostics;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing;
using System.IO;/*  w  ww  .ja  va 2 s.  c  o  m*/
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Collections;
using System.Configuration;
using System.Text;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Data;
using System.Threading;
using System;

public class Main{
    public static byte[] SaveAsBitmap(Bitmap bmp)
      {
         MemoryStream ms = new MemoryStream();

         bmp.Save(ms, ImageFormat.Bmp);

         return ms.ToArray();
      }
        public static void SaveAsBitmap(Bitmap bmp, string filename)
      {
         IO.SaveFile(filename, SaveAsBitmap(bmp));
      }
}

Related Tutorials