首页 > 代码库 > c#读取图片文件
c#读取图片文件
1 /// <summary> 2 /// 读取图片文件 3 /// </summary> 4 /// <param name="path">图片文件路径</param> 5 /// <returns>图片文件</returns> 6 private Bitmap ReadImageFile(String path) 7 { 8 Bitmap bitmap=null; 9 try 10 { 11 FileStream fileStream = File.OpenRead(path); 12 Int32 filelength = 0; 13 filelength = (int)fileStream.Length; 14 Byte[] image = new Byte[filelength]; 15 fileStream.Read(image, 0, filelength); 16 System.Drawing.Image result = System.Drawing.Image.FromStream(fileStream); 17 fileStream.Close(); 18 bitmap = new Bitmap(result); 19 } 20 catch (Exception ex) 21 { 22 // 异常输出 23 } 24 return bitmap; 25 }
c#读取图片文件
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。