image与byte数组的转换[引用]
image to byte[]
MemoryStream ms=new MemoryStream();
byte[] imagedata=null;
pictureBox1.Image.Save(ms,System.Drawing.Imaging.ImageFormat.Gif );
imagedata=ms.GetBuffer ();
byte[] to image
System.Drawing.Image img;
MemoryStream ms=new MemoryStream();
ms = new System.IO.MemoryStream((byte[])Content );
img = System.Drawing.Image.FromStream(ms);
if(img.Width>Convert.ToInt32( _width))
{
_width=500;
_height=(img.Height*Convert.ToInt32(_width))/img.Width;
}
else
{
_width=img.Width;
_height=img.Height;
}
img.Dispose();
MemoryStream ms=new MemoryStream();
byte[] imagedata=null;
pictureBox1.Image.Save(ms,System.Drawing.Imaging.ImageFormat.Gif );
imagedata=ms.GetBuffer ();
byte[] to image
System.Drawing.Image img;
MemoryStream ms=new MemoryStream();
ms = new System.IO.MemoryStream((byte[])Content );
img = System.Drawing.Image.FromStream(ms);
if(img.Width>Convert.ToInt32( _width))
{
_width=500;
_height=(img.Height*Convert.ToInt32(_width))/img.Width;
}
else
{
_width=img.Width;
_height=img.Height;
}
img.Dispose();
image to byte[]
MemoryStream ms=new MemoryStream();
byte[] imagedata=null;
pictureBox1.Image.Save(ms,System.Drawing.Imaging.ImageFormat.Gif );
imagedata=ms.GetBuffer ();
byte[] to image
System.Drawing.Image img;
MemoryStream ms=new MemoryStream();
ms = new System.IO.MemoryStream((byte[])Content );
img = System.Drawing.Image.FromStream(ms);
if(img.Width>Convert.ToInt32( _width))
{
_width=500;
_height=(img.Height*Convert.ToInt32(_width))/img.Width;
}
else
{
_width=img.Width;
_height=img.Height;
}
img.Dispose();
MemoryStream ms=new MemoryStream();
byte[] imagedata=null;
pictureBox1.Image.Save(ms,System.Drawing.Imaging.ImageFormat.Gif );
imagedata=ms.GetBuffer ();
byte[] to image
System.Drawing.Image img;
MemoryStream ms=new MemoryStream();
ms = new System.IO.MemoryStream((byte[])Content );
img = System.Drawing.Image.FromStream(ms);
if(img.Width>Convert.ToInt32( _width))
{
_width=500;
_height=(img.Height*Convert.ToInt32(_width))/img.Width;
}
else
{
_width=img.Width;
_height=img.Height;
}
img.Dispose();
image to byte[]
MemoryStream ms=new MemoryStream();
byte[] imagedata=null;
pictureBox1.Image.Save(ms,System.Drawing.Imaging.ImageFormat.Gif );
imagedata=ms.GetBuffer ();
byte[] to image
System.Drawing.Image img;
MemoryStream ms=new MemoryStream();
ms = new System.IO.MemoryStream((byte[])Content );
img = System.Drawing.Image.FromStream(ms);
if(img.Width>Convert.ToInt32( _width))
{
_width=500;
_height=(img.Height*Convert.ToInt32(_width))/img.Width;
}
else
{
_width=img.Width;
_height=img.Height;
}
img.Dispose();
MemoryStream ms=new MemoryStream();
byte[] imagedata=null;
pictureBox1.Image.Save(ms,System.Drawing.Imaging.ImageFormat.Gif );
imagedata=ms.GetBuffer ();
byte[] to image
System.Drawing.Image img;
MemoryStream ms=new MemoryStream();
ms = new System.IO.MemoryStream((byte[])Content );
img = System.Drawing.Image.FromStream(ms);
if(img.Width>Convert.ToInt32( _width))
{
_width=500;
_height=(img.Height*Convert.ToInt32(_width))/img.Width;
}
else
{
_width=img.Width;
_height=img.Height;
}
img.Dispose();