You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to SkiaSharp to latest version 3.116.1
in NuGet running application throws System.TypeInitializationException
Code
using SkiaSharp;
public static class Thumbnail
{
public static byte[] MakeMeAGoodThumbnail(byte[] source, int imageHeight, int imageWidth)
{
// https://stackoverflow.com/questions/73860277/what-is-the-decent-approach-to-resizing-images-in-asp-net-core
SKBitmap image = SKBitmap.Decode(source);
var ratioX = (double)imageWidth / image.Width;
var ratioY = (double)imageHeight / image.Height;
var ratio = Math.Min(ratioX, ratioY);
var newWidth = (int)(image.Width * ratio);
var newHeight = (int)(image.Height * ratio);
var info = new SKImageInfo(newWidth, newHeight);
image = image.Resize(info, SKFilterQuality.High);
using var ms = new MemoryStream();
image.Encode(ms, SKEncodedImageFormat.Png, 100);
return ms.ToArray();
}
}
System.TypeInitializationException: The type initializer for 'SkiaSharp.SKData' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
/lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /var/www/myapp/libSkiaSharp.so)
libSkiaSharp.so: cannot open shared object file: No such file or directory
/var/www/myapp/liblibSkiaSharp.so: cannot open shared object file: No such file or directory
/var/www/myapp/libSkiaSharp: cannot open shared object file: No such file or directory
/var/www/myapp/liblibSkiaSharp: cannot open shared object file: No such file or directory
at SkiaSharp.SkiaApi.sk_data_new_empty()
at SkiaSharp.SkiaApi.sk_data_new_empty() at SkiaSharp.SKData..cctor()
--- End of inner exception stack trace ---
at SkiaSharp.SKData.Create(IntPtr address, Int32 length)
at SkiaSharp.SKBitmap.Decode(ReadOnlySpan`1 buffer)
at SkiaSharp.SKBitmap.Decode(Byte[] buffer)
....
Version of SkiaSharp
3.116.1 (Current)
Last Known Good Version of SkiaSharp
2.88.9 (Previous)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Linux
Platform / Operating System Version
Debian GNU/Linux 10 (buster)
Devices
Debian VPS server
Relevant Screenshots
No response
Relevant Log Output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Description
ASP.NET 9 MVC application is running in Debian 10 (buster) server. It use captcha
https://github.com/VahidN/DNTCaptcha.Core
nuget package whose latest version requires Skiasharp 3.116.1
https://www.nuget.org/packages/SkiaSharp.NativeAssets.Linux.NoDependencies/3.116.1
After upgrading to SkiaSharp to latest version 3.116.1
in NuGet running application throws System.TypeInitializationException
Code
using SkiaSharp;
public static class Thumbnail
{
public static byte[] MakeMeAGoodThumbnail(byte[] source, int imageHeight, int imageWidth)
{
// https://stackoverflow.com/questions/73860277/what-is-the-decent-approach-to-resizing-images-in-asp-net-core
SKBitmap image = SKBitmap.Decode(source);
var ratioX = (double)imageWidth / image.Width;
var ratioY = (double)imageHeight / image.Height;
var ratio = Math.Min(ratioX, ratioY);
var newWidth = (int)(image.Width * ratio);
var newHeight = (int)(image.Height * ratio);
var info = new SKImageInfo(newWidth, newHeight);
image = image.Resize(info, SKFilterQuality.High);
using var ms = new MemoryStream();
image.Encode(ms, SKEncodedImageFormat.Png, 100);
return ms.ToArray();
}
}
Expected Behavior
It should work in Debian 10 like previous version https://www.nuget.org/packages/SkiaSharp.NativeAssets.Linux.NoDependencies/3.116.0
Actual Behavior
Version of SkiaSharp
3.116.1 (Current)
Last Known Good Version of SkiaSharp
2.88.9 (Previous)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Linux
Platform / Operating System Version
Debian GNU/Linux 10 (buster)
Devices
Debian VPS server
Relevant Screenshots
No response
Relevant Log Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: