-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with WebP support #107
Comments
Hmm, I thought this was a OS thing. I just tried https://github.com/SixLabors/ImageSharp out of interest and it works without issue on 472. var fromBase64String = Convert.FromBase64String("UklGRsACAABXRUJQVlA4ILQCAADQFACdASogACAAPgQBQAAACJZgCdMoRwN67+Ev6q3gc8l87/Jn+q9DN6gH6V7wD9d/2A4QD9M+sA9AD9VfSZ/VX4Hf2H/ZL4AP00uzv4p+FfUDdevUbJcvDPwx/JbUGfyX8gP1V/uWcBfFv6N+MH4zbID+Af3r8ldd7/YPxm/oHwt5kXmH/T+4F/D/5H/Vfxy/vX/n5Uv9VQ7UDRfbyfP1PPTq52tzX06Y9zudfwUAAP7//rtpve1v1ky90qXpBgB4bus9vIL83KeFODqf4yUU3dFCg7cpPgl4CoP0eeD10Ftln5z6s/X91zc8dD/+bkoO9fdPp/d2eCb38BYpPTAFj7/oYCH+XcVa8sdWHvIGzrPbbXWf1XUlpHva//yG3kDP7YmnGKaFRTUwFTUKxF/r/3Rdt/Yl8P/+dsLM0ltaduY0Ehm/o9kxzW+OmBxf/f+49m+Tt03lHkL/BRkAyGrr+cUQIVaHdEskP3sXCf0NNPxE8fttsaS8eJtEPu18qWantFIuCZ3E9LiWG69lqPcRotHVUw/VAcKsBqfW7UMRU6D+kThFE0EoHWUc+oX5S5JtSx+RvxkBA1fUYyI8MUJX6hEih6Wk5OJi2Bsd258iyTKyMqpDO4TSdJN//7Lj9AJGif3//R4TxeL/U0c5xUgklQ90yWBTFgdWn7c5asm+vIWFzvyisqziwZHlAOb53da9fPrdu6O2h3M2nAu6e+DMY0+Cmak7zOBYuApaayrELZwoqTo1L1JDSardQEN9qyzIYRAoWC7UQ2bEewV5EuPRJFqW6DWDlCffGP1OT9N7tdn2g0I9Z/DJi8c0v//fa8qhD/45DRmdzj46hftRgmeQLfFk+5tNiqbcViSRMqMaGL6siXavzqvDx6oPJN5MQoh8781530v4T1a0Ghw4BSf24AAAAA==");
var imageInfo = SixLabors.ImageSharp.Image.Identify(fromBase64String);
Console.WriteLine(imageInfo.Width);
Console.WriteLine(imageInfo.Height); |
I'm guessing your app is either ASP.NET (though I don't know why you'd have The first error you listed is a result of the fact the Windows WebP codec is installed as a Microsoft Store app so it's not available under all user accounts and may not be available on Server installations. The second error, with the WebP plugin installed, is a simple DLL resolution issue. Modern .NET has support for native binary packaging all the way through the SDK, so when you publish an app, all the correct native binaries go with it. That's why net6.0 targets work with no hassle. .NET Framework didn't have the same, so the best I can do is put a step in the package definition that copies the binaries to a known location and then try to find them there at runtime. The current release version will attempt to load the I have also improved the runtime DLL resolution logic for .NET Framework recently, so you can try the latest version from the CI NuGet feed which should work in more cases. That updated version still relies on the DLLs being in an architecture folder alongside the managed assembly, but it uses the Finally, ImageSharp has its own WebP implementation written in C#, so it doesn't depend on any external codec libraries. Its WebP implementation is significantly slower than |
It's a standalone app, so I can replicate the problem in isolation [1] [2]. The actual app is hosted on Server2019 in IIS :)
On my home machine (Windows 10) this works:- PS C:\Users\Indy> Get-AppxPackage Microsoft.WebpImageExtension
Name : Microsoft.WebpImageExtension
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 1.0.52351.0
PackageFullName : Microsoft.WebpImageExtension_1.0.52351.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.WebpImageExtension_1.0.52351.0_x64__8wekyb3d8bbwe
IsFramework : False
PackageFamilyName : Microsoft.WebpImageExtension_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok At work (Server2019) the same command returns nothing. So I presume that WebP is not supported on Server2019.
Makes total sense, I appreciate the best effort. In reality we need to move off NET Framework and get onto dotnet-new.
Ah, good to know! Right now we have settled on PhotoSauce as it is blazing fast, and we can ignore WebP for now. Cheers, [1] http://sscce.org/ |
Thanks Indy and Saucecontrol for those helpful details! I'm facing this exact issue in our .NET 4.8 project. Like Indy, I received the I tried installing the latest CI versions (MagicScaler 0.14.0-ci230591 and Libwebp 1.3.0-ci230591), but unfortunately I still receive the same "unable to load DLL" error. If I use I know I can copy the dll up a directory, but that doesn't work very well for mixed x86/x64 projects that share a calling dll, and it also isn't handled automatically when unstalling NuGet packages. Can you think of anything else I can try? |
Interesting. Thanks for letting me know. The updated code in the CI builds uses PhotoSauce/src/MagicScaler/Utilities/MiscExtensions.cs Lines 121 to 128 in 7953b64
Worst case, you can do the resolution yourself by P/Invoking |
That's interesting. In my test, So, just trying to guess why it doesn't work as expected already... I notice that the logic in |
I suppose it's possible you've got the NetStandard binaries from the package instead, but that shouldn't be the case if you're using a current SDK to build your app. Are you using You can, of course, check the code in your deployed app with ILSpy or the like to be absolutely sure you've got the binary you think you do. |
Good suggestion. I do see the relevant code in my
|
Hmmm... Yeah, if the code is there and the code works independently, I'm out of ideas. If you do find something to explain it, please let me know. |
Possibly there's an issue with order of operations? I'm not sure if I'm on the right track, as I'm just trying to hit some breakpoints within disassembled optimized code, but it looks to me like Also in case it is relevant to the expected order of things my calling code looks like: |
Your usage looks fine, and if you're hitting a breakpoint inside the |
I'm looking at the documentation for |
Aw jeez, I misread that. Yes, you're absolutely right. I've pushed an update that checks the dependencies from Turns out my tests were passing because they do a WebP encode before attempting to decode. Since the encoder was properly checking/loading the dependencies, it was getting taken care of there before reaching the unprotected calls. Thanks for the investigation! |
Awesome, thanks for the insanely fast support! I waited for the successful build and confirmed that this fix is working for me. 👍 And yeah I hadn't ever hit a breakpoint in For my planning, any projections on timeline for the next formal NuGet release? |
Great, thanks for the quick feedback! Next official release will come when I complete work on my BMP (managed) and TIFF ( |
Blows up with:-
So I tried https://www.nuget.org/packages/PhotoSauce.NativeCodecs.Libwebp as per #92 (comment) and updated sample:-
Then the exception changes to:-
Environment:-
Unfortunately, we are using net framework 472 (we are in the processing of slowly moving to dotnet-6.0).
I get the same error with dotnet-6.0 until I install
PhotoSauce.NativeCodecs.Libwebp
.Not sure what (if anything) can be done here?
Cheers,
Indy
The text was updated successfully, but these errors were encountered: