### fast-blurhash
Minimal, fast BlurHash encoder/decoder for Python. A wrapper around the Rust [`fast-blurhash`](https://github.com/Sofiman/fast-blurhash) crate, with fully typed API and support for CPython 3.10–3.13.
### Install
```bash
uv add "fast-blurhash"
# If you want to use PIL functionality
uv add "fast-blurhash[pillow]"
```
### Usage
- **Encode from PIL.Image**
```python
from fast_blurhash import encode
from PIL import Image
with Image.open("image.png") as img:
h = encode(img, x_components=4, y_components=3)
print(h) # e.g. "LEHV6nWB2yk8pyo0adR*.7kCMdnj"
```
- **Encode from raw bytes** (RGB or RGBA)
```python
from fast_blurhash import encode, PixelMode
# pixels: bytes of length width * height * channels
# e.g. Image.tobytes()
blurhash_str = encode(pixels, 4, 3, width=640, height=480, mode=PixelMode.RGB)
```
- **Decode to raw bytes (RGB)**
```python
from fast_blurhash import decode
pixels = decode("LEHV6nWB2yk8pyo0adR*.7kCMdnj", width=32, height=32)
# len(pixels) == 32 * 32 * 3
```
- **Decode to PIL.Image** (requires Pillow)
```python
from fast_blurhash import decode, DecodeType, PixelMode
img = decode("LEHV6nWB2yk8pyo0adR*.7kCMdnj", 32, 32, as_=DecodeType.PIL, mode=PixelMode.RGBA)
img.save("preview.png")
```
Raw data
{
"_id": null,
"home_page": "https://github.com/uuuutsu/fast-blurhash",
"name": "fast-blurhash",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "blurhash, image, rust, pyo3, ffi, bindings",
"author": "\u30a2\u30f3\u30c9\u30ed",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/98/bf/94c1ffaaa1490cd92bbe259e7cd8884a9212a72dd2793939f2be0148a2fd/fast_blurhash-0.4.0.tar.gz",
"platform": null,
"description": "### fast-blurhash\n\nMinimal, fast BlurHash encoder/decoder for Python. A wrapper around the Rust [`fast-blurhash`](https://github.com/Sofiman/fast-blurhash) crate, with fully typed API and support for CPython 3.10\u20133.13.\n\n### Install\n\n```bash\nuv add \"fast-blurhash\"\n# If you want to use PIL functionality\nuv add \"fast-blurhash[pillow]\"\n```\n\n### Usage\n\n- **Encode from PIL.Image**\n```python\nfrom fast_blurhash import encode\nfrom PIL import Image\n\nwith Image.open(\"image.png\") as img:\n h = encode(img, x_components=4, y_components=3)\n print(h) # e.g. \"LEHV6nWB2yk8pyo0adR*.7kCMdnj\"\n```\n\n- **Encode from raw bytes** (RGB or RGBA)\n```python\nfrom fast_blurhash import encode, PixelMode\n\n# pixels: bytes of length width * height * channels\n# e.g. Image.tobytes()\nblurhash_str = encode(pixels, 4, 3, width=640, height=480, mode=PixelMode.RGB)\n```\n\n- **Decode to raw bytes (RGB)**\n```python\nfrom fast_blurhash import decode\n\npixels = decode(\"LEHV6nWB2yk8pyo0adR*.7kCMdnj\", width=32, height=32)\n# len(pixels) == 32 * 32 * 3\n```\n\n- **Decode to PIL.Image** (requires Pillow)\n```python\nfrom fast_blurhash import decode, DecodeType, PixelMode\n\nimg = decode(\"LEHV6nWB2yk8pyo0adR*.7kCMdnj\", 32, 32, as_=DecodeType.PIL, mode=PixelMode.RGBA)\nimg.save(\"preview.png\")\n```\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Minimal, fast BlurHash encoder/decoder for Python. A wrapper around the Rust fast-blurhash crate, with fully typed API and support for CPython 3.10\u20133.13.",
"version": "0.4.0",
"project_urls": {
"Homepage": "https://github.com/uuuutsu/fast-blurhash"
},
"split_keywords": [
"blurhash",
" image",
" rust",
" pyo3",
" ffi",
" bindings"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "77f5fc913ec90c84e4eae5c2268c376ad1f2eb82bba9341a000db968c519f8dd",
"md5": "a6dd8024fafe32e355d2df396603de35",
"sha256": "e61ad9192d05cf590f9eafd788183c998146113b63b23c8d3aa5d07c84ea89c9"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "a6dd8024fafe32e355d2df396603de35",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 190314,
"upload_time": "2025-08-16T22:04:33",
"upload_time_iso_8601": "2025-08-16T22:04:33.834163Z",
"url": "https://files.pythonhosted.org/packages/77/f5/fc913ec90c84e4eae5c2268c376ad1f2eb82bba9341a000db968c519f8dd/fast_blurhash-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "376dfc02b21596a48829651cbdb00c8464cb8a78bcc6a37ca7c0b9516bfe302f",
"md5": "e6515c37a2972b2cf1ece6583d169bf7",
"sha256": "363470ae409d2abada517a664f4ff341a8a07fe0656c0b321e8bf55a2bfe8e88"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "e6515c37a2972b2cf1ece6583d169bf7",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 176887,
"upload_time": "2025-08-16T22:04:32",
"upload_time_iso_8601": "2025-08-16T22:04:32.659978Z",
"url": "https://files.pythonhosted.org/packages/37/6d/fc02b21596a48829651cbdb00c8464cb8a78bcc6a37ca7c0b9516bfe302f/fast_blurhash-0.4.0-cp310-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7123f7cbef8ff8c55a3b9690e74e2fe451f96051ff35e8ed86bec9cf8fec49c7",
"md5": "dc4e93bf552fb53196d6f8b60a0ffa44",
"sha256": "cc3526e1e7f1ab21c5f266a0dca761288421d3c8c926399636ea9249a33b059b"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "dc4e93bf552fb53196d6f8b60a0ffa44",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 185645,
"upload_time": "2025-08-16T22:04:25",
"upload_time_iso_8601": "2025-08-16T22:04:25.409485Z",
"url": "https://files.pythonhosted.org/packages/71/23/f7cbef8ff8c55a3b9690e74e2fe451f96051ff35e8ed86bec9cf8fec49c7/fast_blurhash-0.4.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "33c9ee91a5fd72ccd57df223a31868446954fd019d68ecd6cf796175dbafa9f4",
"md5": "311a4bd550c70e76fc50a5e3d235da34",
"sha256": "c0fe851291d01d7405d8b48eadbf81f4fff05a1e5dee6d307479f6a31f5c7ff8"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
"has_sig": false,
"md5_digest": "311a4bd550c70e76fc50a5e3d235da34",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 197365,
"upload_time": "2025-08-16T22:04:26",
"upload_time_iso_8601": "2025-08-16T22:04:26.681644Z",
"url": "https://files.pythonhosted.org/packages/33/c9/ee91a5fd72ccd57df223a31868446954fd019d68ecd6cf796175dbafa9f4/fast_blurhash-0.4.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "176fefa72c3b27b6166eea31f2d86822f3d9cef5b9553f8e86bbdc63980b48c8",
"md5": "1ee633c874336fdc2a28df7eccdd75e1",
"sha256": "65c1e520035087510ff539d49b59a48232fa32889838e03112e29071fc49244a"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"has_sig": false,
"md5_digest": "1ee633c874336fdc2a28df7eccdd75e1",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 219660,
"upload_time": "2025-08-16T22:04:28",
"upload_time_iso_8601": "2025-08-16T22:04:28.074752Z",
"url": "https://files.pythonhosted.org/packages/17/6f/efa72c3b27b6166eea31f2d86822f3d9cef5b9553f8e86bbdc63980b48c8/fast_blurhash-0.4.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e76a9d871a7cc40ee4468ae5a044c8a6c73017b92537eaae0036e882c533cc0e",
"md5": "62fa9081eea422d37f2ab4d5248b0a35",
"sha256": "7ff3f386e24fb773af7878168d95c5d73cf5e40708b14115ec64c50eb50d1b28"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"has_sig": false,
"md5_digest": "62fa9081eea422d37f2ab4d5248b0a35",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 232278,
"upload_time": "2025-08-16T22:04:28",
"upload_time_iso_8601": "2025-08-16T22:04:28.941066Z",
"url": "https://files.pythonhosted.org/packages/e7/6a/9d871a7cc40ee4468ae5a044c8a6c73017b92537eaae0036e882c533cc0e/fast_blurhash-0.4.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fd4ecdbdd6f100170aed238be017c155dd569db8f7098caf3ab035846f85a62e",
"md5": "1f97427423d7b9b8b0a7b31db783a044",
"sha256": "1b3122121031641cba88e6b15587704f3fe62fde1c2d8980dea10834c5e56d92"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "1f97427423d7b9b8b0a7b31db783a044",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 197570,
"upload_time": "2025-08-16T22:04:31",
"upload_time_iso_8601": "2025-08-16T22:04:31.398540Z",
"url": "https://files.pythonhosted.org/packages/fd/4e/cdbdd6f100170aed238be017c155dd569db8f7098caf3ab035846f85a62e/fast_blurhash-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ef03bd0a3a3dc23211dafc6aa9d721549b586a1472276f88ea8ea4bcbff80eec",
"md5": "1d34f7066f26eb63854d6f9301494cb8",
"sha256": "467641d15eb308bfc7cd5987f6e832dee6fa2869bd98f22630ee3f182a55d22c"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl",
"has_sig": false,
"md5_digest": "1d34f7066f26eb63854d6f9301494cb8",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 212632,
"upload_time": "2025-08-16T22:04:30",
"upload_time_iso_8601": "2025-08-16T22:04:30.134383Z",
"url": "https://files.pythonhosted.org/packages/ef/03/bd0a3a3dc23211dafc6aa9d721549b586a1472276f88ea8ea4bcbff80eec/fast_blurhash-0.4.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "93be674df44db17f8f87948eb0de99912a4f9b54bc22f9a71b82cba656d8d81e",
"md5": "80b684ce0269f5d78925bc092a01f7bb",
"sha256": "714be3d4c7de62a53f1562c282df490fc3db51cb2c6333ec47c5c3f0c4055fa5"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-musllinux_1_2_aarch64.whl",
"has_sig": false,
"md5_digest": "80b684ce0269f5d78925bc092a01f7bb",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 366046,
"upload_time": "2025-08-16T22:04:35",
"upload_time_iso_8601": "2025-08-16T22:04:35.208458Z",
"url": "https://files.pythonhosted.org/packages/93/be/674df44db17f8f87948eb0de99912a4f9b54bc22f9a71b82cba656d8d81e/fast_blurhash-0.4.0-cp310-abi3-musllinux_1_2_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6dff8994e6572b0b63416d80c6447c73c67626ec483d2abc51ac2e99db865a63",
"md5": "ac73d1471ce026faed7f58ad5fdc76aa",
"sha256": "75db5414e53c799e2974c67e6f64d262381de3ac8fbc7540553a24d12c97348f"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-musllinux_1_2_armv7l.whl",
"has_sig": false,
"md5_digest": "ac73d1471ce026faed7f58ad5fdc76aa",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 460948,
"upload_time": "2025-08-16T22:04:36",
"upload_time_iso_8601": "2025-08-16T22:04:36.578174Z",
"url": "https://files.pythonhosted.org/packages/6d/ff/8994e6572b0b63416d80c6447c73c67626ec483d2abc51ac2e99db865a63/fast_blurhash-0.4.0-cp310-abi3-musllinux_1_2_armv7l.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "769363dc1809ced281eb4f7aaa2c465380dbe0fb951f7d61331a7c5414f42da5",
"md5": "e5c20846cc7005be910aee69ab477259",
"sha256": "dfc53854e75979b4763b576313d8dec8e877e38cf0912327ec475bcb35eae2ce"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-musllinux_1_2_i686.whl",
"has_sig": false,
"md5_digest": "e5c20846cc7005be910aee69ab477259",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 394114,
"upload_time": "2025-08-16T22:04:37",
"upload_time_iso_8601": "2025-08-16T22:04:37.602805Z",
"url": "https://files.pythonhosted.org/packages/76/93/63dc1809ced281eb4f7aaa2c465380dbe0fb951f7d61331a7c5414f42da5/fast_blurhash-0.4.0-cp310-abi3-musllinux_1_2_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "17d1467621516fab0dcf30cbbb6e4942474d56d6737a9b5ee1e7af369c5c408a",
"md5": "d21576a1b9d61479faaa7aec03ad87f3",
"sha256": "360233d23ebcc8e10b7bdde0f7171f6e010f2d56c0241df8031ef643e381be44"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "d21576a1b9d61479faaa7aec03ad87f3",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 369074,
"upload_time": "2025-08-16T22:04:38",
"upload_time_iso_8601": "2025-08-16T22:04:38.553766Z",
"url": "https://files.pythonhosted.org/packages/17/d1/467621516fab0dcf30cbbb6e4942474d56d6737a9b5ee1e7af369c5c408a/fast_blurhash-0.4.0-cp310-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8de0b68d30e868bed1e84dc05bf2de0d82dd7db825a50dcc36b9546cc325e904",
"md5": "f27612321456c70272031940d44bd2a9",
"sha256": "9f36dad4661ea9bb2bb2e025e07e32af4265dd0c6f78560effe4d78e3ddb1094"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-win32.whl",
"has_sig": false,
"md5_digest": "f27612321456c70272031940d44bd2a9",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 101144,
"upload_time": "2025-08-16T22:04:41",
"upload_time_iso_8601": "2025-08-16T22:04:41.753111Z",
"url": "https://files.pythonhosted.org/packages/8d/e0/b68d30e868bed1e84dc05bf2de0d82dd7db825a50dcc36b9546cc325e904/fast_blurhash-0.4.0-cp310-abi3-win32.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5cc1af25216917c59836ec789a959807a3db388f6fe71c2fdf01a2ae171fad99",
"md5": "8357105f934e349d34af7c578a4815ce",
"sha256": "c6178e0bb8d4bacc9e0c3acc119957fdc589e1a2cea19ebf65119560d1132280"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0-cp310-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "8357105f934e349d34af7c578a4815ce",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 104882,
"upload_time": "2025-08-16T22:04:40",
"upload_time_iso_8601": "2025-08-16T22:04:40.956659Z",
"url": "https://files.pythonhosted.org/packages/5c/c1/af25216917c59836ec789a959807a3db388f6fe71c2fdf01a2ae171fad99/fast_blurhash-0.4.0-cp310-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "98bf94c1ffaaa1490cd92bbe259e7cd8884a9212a72dd2793939f2be0148a2fd",
"md5": "accdc9317513e54dc384619dfa11b4de",
"sha256": "09183fd75ec664bf76829b7926a32766b5d638d2b0431ddf2541040f55187308"
},
"downloads": -1,
"filename": "fast_blurhash-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "accdc9317513e54dc384619dfa11b4de",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 2467026,
"upload_time": "2025-08-16T22:04:39",
"upload_time_iso_8601": "2025-08-16T22:04:39.769669Z",
"url": "https://files.pythonhosted.org/packages/98/bf/94c1ffaaa1490cd92bbe259e7cd8884a9212a72dd2793939f2be0148a2fd/fast_blurhash-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-16 22:04:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "uuuutsu",
"github_project": "fast-blurhash",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "fast-blurhash"
}