blurhash

授权协议 MIT License
开发语言 Nim
所属分类 程序开发、 图形/图像处理
软件类型 开源软件
地区 不详
投 递 者 安承教
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

blurhash

Pure Nim implementation of Blurhash

Blurhash is an algorithm written by Dag Ågren for Wolt (woltapp/blurhash) that encodes an image into a short (~20-30 byte) ASCII string. When you decode the string back into an image, you get a gradient of colors that represent the original image. This can be useful for scenarios where you want an image placeholder before loading, or even to censor the contents of an image a la Mastodon.

Installation

nimble install blurhash

Usage

Add requires "blurhash" to your .nimble file.

Encoding

import blurhash, imageman/[images, colors]

let
  image = loadImage[ColorRGB]("image.png")
  hash = image.encode(5, 5)

echo hash

This snippet hashes following image into this compact string: UrQ]$mfQ~qj@ocofWFWB?bj[D%azf6WBj[t7

Decoding

import blurhash, imageman/images

let image = "UrQ]$mfQ~qj@ocofWFWB?bj[D%azf6WBj[t7".decode[ColorRGBU](500, 500)

image.savePNG "blurred.png"

This results in following image:

Other

Reference image author - https://rigani.me

  • [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-oJABtYBp-1629332631551)(https://ducafecat.tech/2021/08/19/translation/exploring-blurhash-image-placeholder-in-flutter/2021-08-19-06-32-44.png)] 原文 https://medium

 相关资料
  • go-blurhash A pure Go implementation of Blurhash. The API is stable, however the hashing function in either direction may not be. Blurhash is an algorithm written by Dag Ågren for Wolt (woltapp/blurha

  • Blurhash ��️ Give your users the loading experience they want. Install via npm: npm i react-native-blurhashnpx pod-install BlurHash is a compact representation of a placeholder for an image. Instead o

相关阅读

相关文章

相关问答

相关文档