![]() |
VOOZH | about |
dotnet add package GlitchedPolygons.ThumbHash --version 1.4.1
NuGet\Install-Package GlitchedPolygons.ThumbHash -Version 1.4.1
<PackageReference Include="GlitchedPolygons.ThumbHash" Version="1.4.1" />
<PackageVersion Include="GlitchedPolygons.ThumbHash" Version="1.4.1" />Directory.Packages.props
<PackageReference Include="GlitchedPolygons.ThumbHash" />Project file
paket add GlitchedPolygons.ThumbHash --version 1.4.1
#r "nuget: GlitchedPolygons.ThumbHash, 1.4.1"
#:package GlitchedPolygons.ThumbHash@1.4.1
#addin nuget:?package=GlitchedPolygons.ThumbHash&version=1.4.1Install as a Cake Addin
#tool nuget:?package=GlitchedPolygons.ThumbHash&version=1.4.1Install as a Cake Tool
GlitchedPolygons.ThumbHash:
GlitchedPolygons.ThumbHash.Img:
A very compact representation of an image placeholder for .NET 10+
This is a high-performance, memory-friendly C# port of the original ThumbHash implementation. ThumbHash allows you to store a tiny hash (usually around ~20 bytes) of an image and render a blurred version while the full image loads.
Compared to BlurHash, ThumbHash offers:
To create a hash, you need the raw RGBA pixel data of your image. Note: The input image must be ≤ 100x100 pixels for performance reasons.
Scale your image down before encoding.
// w: width, h: height, rgba: ReadOnlySpan<byte> of pixel data
Span<byte> hash = ThumbHashConvert.FromRgba(width, height, rgba);
// Store this small byte array in your database or alongside the
// original image to render while the full resolution version is loading.
string base64Hash = Convert.ToBase64String(hash);
The easiest way to show a placeholder in a web application is to generate a data:image/png;base64 string.
string dataUrl = ThumbHashConvert.ToDataUrl(hash);
// Result: "data:image/png;base64,iVBORw0KGgoAAAAN..."
If you need to render the image yourself (e.g., in a desktop or mobile app):
(int w, int h, byte[] rgba) = ThumbHashConvert.ToRgba(hash);
This implementation is designed with performance in mind:
Span<T> to minimize memory allocations.ArrayPool<T> for internal buffers to reduce GC pressure.stackalloc where possible for best performance.100x100 or smaller before passing them to ThumbHashConvert.FromRgba.src attribute of an <img> tag or as a CSS background-image.This project is licensed under the MIT License - same as the original implementation by Evan Wallace.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on GlitchedPolygons.ThumbHash:
| Package | Downloads |
|---|---|
|
GlitchedPolygons.ThumbHash.Img
C# implementation of ThumbHash (https://github.com/evanw/thumbhash) |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.4.1 | 177 | 5/11/2026 |