Data Browser - Viewing Site  Sector 23 Code Bank Logged in as:  Guest  


Image.Save: Value cannot be null. Parameter name: encoder
Calling image.Save on a .NET Image may fail with the following exception:

img.Save(stream, img.RawFormat);
> Value cannot be null. Parameter name: encoder

There are many reasons for this, but it could be due to the second argument not working.
For example, if you call img.RotateFlip, it wipes out the RawFormat of the image.

So, make sure you either pass a valid format, such as BMP, or you cache the format prior to calling RotateFlip:

var imageFormat = myImage.RawFormat;
myImage.Save(streamFullSize, imageFormat);

Created By: amos 9/24/2013 6:18:32 PM