Search code examples
c#.netwinformspicturebox

Save original image from PictureBox, not resized


Is it possible to save original image with original quality from PictureBox, not the stretched/resized one? I download byte array from a server and put it in PictureBox, I want user to be able to save the actual image, but it should be the original image (original quality and original size) I received from the HTTP server, not resized and reduced quality one that I show in a PictureBox. Is it possible or do I have to store the byte array I receive from server somewhere in order to achieve this?


Solution

  • Image property of the PictureBox contains the original image, while the control may paint the image as zoom/resized/stretched depending to its SizeMode. You can see the source code for the property here. Just save the Image property and it will be the same image which you had read from database.

    So calling pictureBox1.Image.Save will be enough.