Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shawn Bowen 11 posts 71 karma points
    26 days ago
    Shawn Bowen
    0

    ImageProcessor.Plugins.WebP - Cannot load libwebp.dll

    I'm attempting to implement the WebP image format using the ImageProcessor.Plugins.WebP library and the Umbraco image cropper. The package was installed using Nuget and everything works like a charm when run through Visual Studio on my development workstation. However, when I put the same source code out on a production server (Windows Server 2012 R2 Standard) the code fails with the following error:

    Server Error in '/' Application.
    Cannot load libwebp.dll
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: System.ApplicationException: Cannot load libwebp.dll
    
    Source Error: 
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    
    Stack Trace: 
    
    [ApplicationException: Cannot load libwebp.dll]
       ImageProcessor.Configuration.<>c__DisplayClass7_0.<RegisterNativeBinary>b__0(String b) +391
       System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +65
       ImageProcessor.Configuration.NativeBinaryFactory.RegisterNativeBinary(String name, Byte[] resourceBytes) +86
       ImageProcessor.Plugins.WebP.Imaging.Formats.NativeMethods..cctor() +208
    
    [TypeInitializationException: The type initializer for 'ImageProcessor.Plugins.WebP.Imaging.Formats.NativeMethods' threw an exception.]
       ImageProcessor.Plugins.WebP.Imaging.Formats.NativeMethods.WebPFree(IntPtr pointer) +0
       ImageProcessor.Plugins.WebP.Imaging.Formats.WebPFormat.EncodeLossly(Bitmap bitmap, Int32 quality, Byte[]& webpData) +268
       ImageProcessor.Plugins.WebP.Imaging.Formats.WebPFormat.Save(Stream stream, Image image, Int64 bitDepth) +88
       ImageProcessor.ImageFactory.Save(Stream stream) +69
       ImageProcessor.Web.HttpModules.<ProcessImageAsync>d__34.MoveNext() +2754
       System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
       System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
       System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) +63
       System.Web.AsyncEventExecutionStep.InvokeEndHandler(IAsyncResult ar) +156
       System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +123
    
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3062.0
    

    I've verified that the dll is in the /bin folder and that the Application Pool is allowing 32 bit applications enabled.

    Any thoughts on what the issue might be?

  • Søren Gregersen 232 posts 954 karma points c-trib
    26 days ago
    Søren Gregersen
    0

    Hi,

    On the plugin page https://imageprocessor.org/imageprocessor/plugins/webp/ it says:

    Requires msvcr120.dll from the Visual C++ Redistributable Package for Visual Studio 2013 to be installed on the server.

    If you are using version 1.0.2 or lower it instead requires msvcr110.dll from the Visual C++ Redistributable Package for Visual Studio 2012 to be installed.

    Have you verified this?

  • Shawn Bowen 11 posts 71 karma points
    26 days ago
    Shawn Bowen
    0

    Yes, thanks. I made sure to install the Visual C++ Redistributable Package for Visual Studio 2012 package on the server and verified that msvcr120.dll is in fact in the C:\Windows\System32 path.

Please Sign in or register to post replies

Write your reply to:

Draft