C# WebP image throwing error “An attempt was made

2019-09-14 20:17发布

I am try to convert jpeg image to webp format. like below in console application

    using (Image image = Image.FromFile("Capture.jpg"))
    {
        Bitmap bitmap = new Bitmap(image);
        WebPFormat.SaveToFile("image.webp", bitmap);
    }

Reference from here

http://webp.codeplex.com/

Below details of error

Error: An unhandled exception of type 'System.BadImageFormatException' occurred in Noesis.Drawing.Imaging.WebP.dll Additional information: An attempt was made to load a program with an incorrect format.

ErrorMessage : An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

StatckTrace: at Noesis.Drawing.Imaging.WebP.NoesisWebP.Save(IntPtr& oWebPFileImage, Int32& oWebPFileImageSize, IntPtr iBitmap, Int32 iWidth, Int32 iHeight, Int32 iQuality) at Noesis.Drawing.Imaging.WebP.WebPFormat.Save(Int32 iQuality, Bitmap iImage) at Noesis.Drawing.Imaging.WebP.WebPFormat.SaveToFile(String iFilename, Int32 iQuality, Bitmap iImage) at WebP.Program.Main(String[] args) in c:-----\Program.cs:line 17 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.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

标签: c# webp
0条回答
登录 后发表回答