画像操作



byte[]をBitmapへ

// byte buf[...]にデータが入っているという前提で。
MemoryStream. MemoryStream ms = new MemoryStream.MemoryStream( buf );
Bitmap bmp = Bitmap.FromStream( ms );


Bitmapをbyte[]へ

Bitmap bmp = new Bitmap("sample.jpg");
MemoryStream ms = new MemoryStream();
bmp.Save(ms, ImageFormat.Jpeg);
byte [] buf = new byte[ms.Length]; 
buf = ms.ToArray();
memStream.Dispose();
最終更新:2008年09月10日 05:49