//根据图片路径读取图片并且转byte[]   类型

                    FileStream fs = new FileStream(filePath, FileMode.Open);
                    byte[] byData = new byte[fs.Length];
                    fs.Read(byData, 0, byData.Length);
                    fs.Close();

 

//根据图片路径读取图片修改长宽 并且转byte[]   类型

            var pic = new Bitmap(filePath);
                    Bitmap newpic = new Bitmap((System.Drawing.Image)pic);                 
                    var savepic = new Bitmap(newpic, 100, 120);
                    MemoryStream ms = new MemoryStream();
                    savepic.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
                    byte[] byData = ms.GetBuffer();  
                    ms.Close(); 

//byte[] 插入到数据库

http://www.cnblogs.com/wdw31210/p/3937417.html

 

相关文章:

  • 2021-04-20
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2021-07-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
相关资源
相似解决方案