How to save PictureBox.Image to file?

后端 未结 2 1590
既然无缘
既然无缘 2020-11-28 13:28

I use the following to write jpgImage to a PictureBox.Image.

var jpgImage = new Byte[jpgImageSize];
...
pictureBox.Image = new Bitmap(new MemoryStream(jpgIma         


        
相关标签:
2条回答
  • 2020-11-28 14:14

    Try this

    pictureBox.Image.Save(@"Path",ImageFormat.Jpeg);
    
    0 讨论(0)
  • 2020-11-28 14:30

    You may use,

    pictureBox.Image.Save(stream,System.Drawing.Imaging.ImageFormat.Jpeg);
    

    Example:

     System.IO.MemoryStream ms = new System.IO.MemoryStream();
     pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
     byte[] ar = new byte[ms.Length];
     ms.Write(ar, 0, ar.Length);
    
    0 讨论(0)
提交回复
热议问题