14
This code fails when trying to call Image.Save(MemoryStream, ImageFormat).
I get the exception:
a Value cannot be null.Parameter name: encoder"
ImageFormat format = generatedImage.RawFormat as ImageFormat;
image.ImageData = generatedImage.Save(format);
It works if I pass in an ImageFormat object directly e.g. ImageFormat.Jpeg.
What is the best way of converting the rawformat to ImageFormat (ideally without a switch statement or lots of if statements)
Thanks Ben