【发布时间】:2011-05-16 06:15:22
【问题描述】:
此代码在尝试调用 Image.Save(MemoryStream, ImageFormat) 时失败。
我得到了例外:
一个值不能为空。参数名称:编码器"
ImageFormat format = generatedImage.RawFormat as ImageFormat;
image.ImageData = generatedImage.Save(format);
如果我直接传入 ImageFormat 对象,它会起作用,例如ImageFormat.Jpeg.
将rawformat 转换为ImageFormat 的最佳方法是什么(最好不要使用switch 语句或大量if 语句)
谢谢 本
【问题讨论】:
标签: c# system.drawing system.drawing.imaging