Blurhash.SkiaSharp
2.0.0
.NET Standard 2.0
dotnet add package Blurhash.SkiaSharp --version 2.0.0
NuGet\Install-Package Blurhash.SkiaSharp -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Blurhash.SkiaSharp" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Blurhash.SkiaSharp --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Blurhash.SkiaSharp, 2.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Blurhash.SkiaSharp as a Cake Addin
#addin nuget:?package=Blurhash.SkiaSharp&version=2.0.0
// Install Blurhash.SkiaSharp as a Cake Tool
#tool nuget:?package=Blurhash.SkiaSharp&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Blurhash.SkiaSharp
A Blurhash implementation based on blurhash.net for SkiaSharp, thus fully available for Xamarin and other .NET Standard 2.0 platforms.
Currently allows to decode a blurhash into SKBitmap
or encode a SKBitmap
into Blurhash string.
Several portions of the code are directly copy-pasted from the System.Drawing implementation.
Tested on Xamarin.Forms on UWP, iOS and Android.
Example usage
Displaying a placeholder for an image in Xamarin.Forms Image control
// decode blurhash instring into a SKBitmap
var im = Blurhash.SkiaSharp.Blurhasher.Decode("LEHV6nWB2yk8pyo0adR*.7kCMdnj", 219, 176);
// load it into a SKImage
var data = SKImage.FromBitmap(im).Encode();
// use as a source for Image control
image1.Source = ImageSource.FromStream(data.AsStream);
Encoding an resource image into a Blurhash string
// get the image from resources
var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TestMobileApp.noah.jpg");
// load to SKImage and to Image control
var img = SKImage.FromEncodedData(stream);
image1.Source = ImageSource.FromFile("noah.jpg");
// create SKBitmap from Image and create a blurhash for it
var hash = Blurhash.SkiaSharp.Blurhasher.Encode(SKBitmap.FromImage(img), 4, 3);
// and show it in a Editor control
editor1.Text = hash;
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Blurhash.Core (>= 2.0.0)
- SkiaSharp (>= 2.88.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Blurhash.SkiaSharp:
Package | Downloads |
---|---|
Blurhash.Microsoft.Extensions.SkiaSharp
Bridge library to use Blurhash with SkiaSharp and ServiceExtensions |
GitHub repositories
This package is not used by any popular GitHub repositories.