public void DecodeImageEqualsBitmap(string encoded) { var bmp = SKBlurHash.DeserializeBitmap(encoded, 20, 10); var img = SKBlurHash.DeserializeImage(encoded, 20, 10); Assert.Equal( bmp.PeekPixels().GetPixelSpan().ToArray(), img.PeekPixels().GetPixelSpan().ToArray()); }
public void CanEncodeAndDecode() { using var img = SKBitmap.Decode(Path.Combine("images", "img1.jpg")); var encoded = SKBlurHash.Serialize(img, 4, 3); Assert.NotNull(encoded); Assert.True(encoded.Length > 6); var decoded = SKBlurHash.DeserializeBitmap(encoded, 12, 10); Assert.NotNull(decoded); }
public void DecodeBitmap(string encoded) { var bmp = SKBlurHash.DeserializeBitmap(encoded, 20, 10); Assert.NotNull(bmp); }
public void InvalidDataThrows(string encoded) { Assert.Throws <ArgumentException>(() => SKBlurHash.DeserializeBitmap(encoded, 20, 10)); }