Back to using BlurHasher but not linked yet
This commit is contained in:
@ -15,20 +15,21 @@ public static class BlurHasher
|
||||
/// <param name="componentsX">The number of components used on the X-Axis for the DCT</param>
|
||||
/// <param name="componentsY">The number of components used on the Y-Axis for the DCT</param>
|
||||
/// <returns>The resulting BlurHash string</returns>
|
||||
public static string Encode(Image image, int componentsX, int componentsY) => Core.Encode(ConvertBitmap(image as Bitmap ?? new Bitmap(image)), componentsX, componentsY);
|
||||
public static ReadOnlySpan<char> Encode(Image image, int componentsX, int componentsY) =>
|
||||
Core.Encode(ConvertBitmap(image as Bitmap ?? new Bitmap(image)), componentsX, componentsY);
|
||||
|
||||
/// <summary>
|
||||
/// Decodes a BlurHash string into a <c>System.Drawing.Image</c>
|
||||
/// </summary>
|
||||
/// <param name="blurhash">The blurhash string to decode</param>
|
||||
/// <param name="blurHash">The blurHash string to decode</param>
|
||||
/// <param name="outputWidth">The desired width of the output in pixels</param>
|
||||
/// <param name="outputHeight">The desired height of the output in pixels</param>
|
||||
/// <param name="punch">A value that affects the contrast of the decoded image. 1 means normal, smaller values will make the effect more subtle, and larger values will make it stronger.</param>
|
||||
/// <returns>The decoded preview</returns>
|
||||
public static Image Decode(string blurhash, int outputWidth, int outputHeight, double punch = 1.0)
|
||||
public static Image Decode(ReadOnlySpan<char> blurHash, int outputWidth, int outputHeight, double punch = 1.0)
|
||||
{
|
||||
Pixel[,] pixelData = new Pixel[outputWidth, outputHeight];
|
||||
Core.Decode(blurhash, pixelData, punch);
|
||||
Core.Decode(blurHash, pixelData, punch);
|
||||
return ConvertToBitmap(pixelData);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user