极品分享

c# 靠谱的bitmap转byte[]

        public static byte[] Bitmap2Byte(Bitmap bitmap)
        {            using (MemoryStream stream = new MemoryStream())
            {
                bitmap.Save(stream , ImageFormat.Jpeg);                byte[] data = new byte[stream.Length];
                stream.Seek(0 , SeekOrigin.Begin);
                stream.Read(data ,0  , Convert.ToInt32(stream.Length));                return data;
            }
        }


2017-04-18 0 /
NET学习
/
标签: 

评论回复

回到顶部