High-performance visual hashing for seamless image loading. Encode images into tiny strings and decode into beautiful, fast-loading blurs
Project description
⚡ useblysh (Python)
High-performance visual hashing for seamless image loading. The unified toolkit for Python and JavaScript to turn heavy images into elegant, byte-sized blurs.
🌟 Why useblysh?
Standard loading="lazy" leaves users staring at empty white boxes. useblysh eliminates this "broken" feel by encoding your images into tiny strings that can be sent inside your JSON API response.
- Full-Stack: Identical hashing logic for Python (Backend) and React (Frontend).
- Zero Layout Shift: Reserve image space instantly to prevent page jumping.
- Performance: Replace 1MB images with 20-byte strings during the initial load.
🛠️ Installation
Backend (Python)
pip install useblysh
🚀 Simple Examples
1. Generate Hash (Python)
Generate hashes on your server using the Python library.
from PIL import Image
from useblysh import encode
# Open an image using Pillow
image = Image.open("path/to/image.jpg")
# Generate the hash (components define detail level)
hash = encode(image, components_x=4, components_y=3)
print(f"Generated Hash: {hash}")
2. Frontend Decoding (React)
The hash generated by this Python module is fully compatible with the useblysh JS package. You can encode on your backend and decode on your frontend using the React component.
import { ImageHash } from 'useblysh';
<ImageHash
hash={storedHash} // The short string from your Python backend
src={imageUrl} // The real high-quality image URL
className="w-full h-64 rounded-xl"
/>
💡 Use Cases
1. Progressive Image Loading
Instead of showing a spinner or a blank box, show a beautiful blurred version of the actual image. This keeps users engaged and makes the site feel faster.
2. Social Media Feeds
For infinite scroll feeds (like Instagram or Pinterest), send the useblysh string in your initial JSON request. The app can render the entire feed layout with placeholders before a single byte of actual image data is even downloaded.
3. SEO & Layout Stability (CLS)
Prevent "layout shift" where content jumps around as images load. useblysh reserves the correct aspect ratio and space immediately.
📖 How it Works
Blysh uses a Discrete Cosine Transform (DCT) to extract the most important color frequencies from an image.
- Encoding: The image is downsampled and converted into a set of mathematical factors, then compressed into a Base83 string.
- Decoding: The frontend takes that string and reconstructs a low-resolution version of the original image, applying a smooth blur filter for an elegant look.
Built with ❤️ for the modern web.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file useblysh-1.0.2.tar.gz.
File metadata
- Download URL: useblysh-1.0.2.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb98682409e2cdc396b7edc12ec3398eab837e1bf6a4139889056cf8917945c9
|
|
| MD5 |
5be4710fcfbe876d314c6e8fca34b695
|
|
| BLAKE2b-256 |
524e881ca0159d21b33c45d89998e151c44ecdca382e26de28b89ffa48cebeb0
|
Provenance
The following attestation bundles were made for useblysh-1.0.2.tar.gz:
Publisher:
useblysh-py.yml on R1SH4BH81/Blysh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
useblysh-1.0.2.tar.gz -
Subject digest:
eb98682409e2cdc396b7edc12ec3398eab837e1bf6a4139889056cf8917945c9 - Sigstore transparency entry: 1122753563
- Sigstore integration time:
-
Permalink:
R1SH4BH81/Blysh@f347600716cddd64859f78b3f18f6584382f9bf3 -
Branch / Tag:
refs/tags/v1.0.2-py - Owner: https://github.com/R1SH4BH81
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
useblysh-py.yml@f347600716cddd64859f78b3f18f6584382f9bf3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file useblysh-1.0.2-py3-none-any.whl.
File metadata
- Download URL: useblysh-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f62b2f30196c5fe8bd5d476b156691a93b9657de5f852df8966f46fc5df4ba3d
|
|
| MD5 |
d787ce1e688a73bc9422b833fffd11c7
|
|
| BLAKE2b-256 |
6447d95471646a84f3be460f540a8eab22080bce6b6ecde2b7c693f61d0402d2
|
Provenance
The following attestation bundles were made for useblysh-1.0.2-py3-none-any.whl:
Publisher:
useblysh-py.yml on R1SH4BH81/Blysh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
useblysh-1.0.2-py3-none-any.whl -
Subject digest:
f62b2f30196c5fe8bd5d476b156691a93b9657de5f852df8966f46fc5df4ba3d - Sigstore transparency entry: 1122753594
- Sigstore integration time:
-
Permalink:
R1SH4BH81/Blysh@f347600716cddd64859f78b3f18f6584382f9bf3 -
Branch / Tag:
refs/tags/v1.0.2-py - Owner: https://github.com/R1SH4BH81
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
useblysh-py.yml@f347600716cddd64859f78b3f18f6584382f9bf3 -
Trigger Event:
push
-
Statement type: