2

In C# .net I have an Image in a picture Box it's displayed correctly but when I save it into some file the image become different completely it become a black image with some red pints .

my code to save the Image is :

pictureBox1.Image.Save(SaveImageDialog.FileName);

Thanks enter image description here

  • Image cannot be seen, url broken probably ? It depends on how you save it. If you save it in JPG, then you cannot save it 1:1. There is always algorithm in the middle to set the "quality" of that image. –  Jul 08 '16 at 06:26
  • Where can I find this algorithm my image is retrieved from the database so it can be of any format , – Ashraf Senan Jul 08 '16 at 06:32
  • http://stackoverflow.com/questions/1397512/find-image-format-using-bitmap-object-in-c-sharp –  Jul 08 '16 at 06:43
  • Here, if you want to save jpeg with various quality : https://msdn.microsoft.com/en-us/library/bb882583(v=vs.110).aspx –  Jul 08 '16 at 06:46
  • Thanks a lot Mr X.. for help , I will try that , Best Wishes – Ashraf Senan Jul 08 '16 at 06:51
  • Just info : If you want the same quality like in DB, then read it as byte array and save it again as byte array, that will be 1:1 –  Jul 08 '16 at 06:53
  • Always make sure you have control over the file format by including the `ImageFormat` parameter! Relying on the save name is __not__ good enough!! – TaW Jul 08 '16 at 08:20

0 Answers0