https://github.com/blackshadowsoftwareltd/blur_hash
Blur Hash Example
https://github.com/blackshadowsoftwareltd/blur_hash
blur blur-image blurhash rust rust-lang
Last synced: about 2 months ago
JSON representation
Blur Hash Example
- Host: GitHub
- URL: https://github.com/blackshadowsoftwareltd/blur_hash
- Owner: blackshadowsoftwareltd
- Created: 2024-01-30T10:24:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-30T10:59:34.000Z (over 1 year ago)
- Last Synced: 2025-04-01T00:39:09.260Z (3 months ago)
- Topics: blur, blur-image, blurhash, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 1.95 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Blur Hash
## Dimensions Calculation
- `>` `pixels` will be `min` and `max` will be calculated
- `<` `pixels` will be `max` and `min` will be calculated
```rust
fn dimensions(w: u32, h: u32) -> (u32, u32) {
let pixels = 50; // ? 50 pixels
let result = if w > h {
let ratio = (w as f32) / (h as f32);
((pixels as f32 * ratio) as u32, pixels)
} else {
let ratio = (h as f32) / (w as f32);
(pixels, (pixels as f32 * ratio) as u32)
};
result
}
```