我有一个返回位图对象的函数。如何在C#中将这样的对象保存为jpg文件?
到目前为止,我有这段代码
b = MakeGrayscale(b);
b.Save("C:\\test.jpg");
我收到此错误消息
{“GDI +中发生了一般错误。”}
StackTrace
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(String filename, ImageFormat format)
at System.Drawing.Image.Save(String filename)
at Convert.Program.Plot(Byte[]& fileBufferArray, Int32 fileSize, Int32 offset) in C:\Users\Administrator\Documents\Visual Studio 2010\Projects\Convert\Convert\Program.cs:line 151
at Convert.Program.Main(String[] args) in C:\Users\Administrator\Documents\Visual Studio 2010\Projects\Convert\Convert\Program.cs:line 42
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
有人可以帮助我吗?