{"id":13726823,"url":"https://github.com/fpapado/blurhash-rust-wasm","last_synced_at":"2025-04-05T14:09:40.376Z","repository":{"id":39449090,"uuid":"199062476","full_name":"fpapado/blurhash-rust-wasm","owner":"fpapado","description":"A Rust and WASM implementation of the blurhash algorithm","archived":false,"fork":false,"pushed_at":"2023-11-27T08:23:48.000Z","size":2274,"stargazers_count":198,"open_issues_count":23,"forks_count":12,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-29T13:11:47.822Z","etag":null,"topics":["blurhash","image","placeholder","wasm"],"latest_commit_sha":null,"homepage":"https://blurhash-wasm.netlify.com/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fpapado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-07-26T18:22:10.000Z","updated_at":"2025-03-03T01:58:28.000Z","dependencies_parsed_at":"2024-01-06T07:50:01.906Z","dependency_job_id":"9b27c535-5e57-4cda-9177-38384a8ef21b","html_url":"https://github.com/fpapado/blurhash-rust-wasm","commit_stats":{"total_commits":41,"total_committers":3,"mean_commits":"13.666666666666666","dds":0.09756097560975607,"last_synced_commit":"a81e33c46a10a63f1f0ed25aa48a6e3066d26804"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpapado%2Fblurhash-rust-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpapado%2Fblurhash-rust-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpapado%2Fblurhash-rust-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpapado%2Fblurhash-rust-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fpapado","download_url":"https://codeload.github.com/fpapado/blurhash-rust-wasm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345856,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blurhash","image","placeholder","wasm"],"created_at":"2024-08-03T01:03:25.235Z","updated_at":"2025-04-05T14:09:40.353Z","avatar_url":"https://github.com/fpapado.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# blurhash-wasm\n\nA Rust implementation of the [blurhash algorithm](https://github.com/woltapp/blurhash).\n\nIt is compiled to WebAssembly (WASM), and [available on npm as `blurhash-wasm`](https://npmjs.com/blurhash-wasm).\n\nBlurHash is an algorithm written by [Dag Ågren](https://github.com/DagAgren) and folks at [Wolt (woltapp/blurhash)](https://github.com/woltapp/blurhash). BlurHash is \"a compact representation of a placeholder for an image.\" It enables you to store that representation in your database. It can then be transferred together with the initial data, in order to decode and show it, before the main image request has finished (or even started).\n\n[Online Demo](https://blurhash-wasm.netlify.com).\n\n## Usage in JS\n\n### Installation\n\nYou will need a package manager, either npm ([comes with node](https://nodejs.org/en/download/)) or [yarn](https://yarnpkg.com/lang/en/docs/install/).\n\nYou will also need a bundler, [webpack](https://webpack.js.org/) or [Rollup](https://rollupjs.org/guide/en/), configured for your project.\n\nThen, in a terminal:\n\n```shell\nnpm install blurhash-wasm\n# Or, yarn add blurhash-wasm\n```\n\nThe [demo app source](/demo) has a complete example of using `blurhash-wasm`.\n\n### decode\n\n```js\nimport * as blurhash from \"blurhash-wasm\";\n\n// You can use this to construct canvas-compatible resources\ntry {\n  const pixels = blurhash.decode(\"LKO2?U%2Tw=w]~RBVZRi};RPxuwH\", 40, 30);\n} catch (error) {\n  console.log(error);\n}\n```\n\n### encode\n\nImplented, aim to be published in 0.3.0\n\n## Usage in Rust\n\n### Installation\n\nYou will need [Rust and Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html).\n\nAdd the version you want to `Cargo.toml`:\n\n```\n[dependencies]\nblurhash-wasm = \"0.1.0\"\n```\n\n### decode\n\n```rust\nuse blurhash_wasm;\n\n// Result\u003cVec\u003cu8\u003e, blurhash::Error\u003e\nlet res = blurhash::decode(\"LKO2?U%2Tw=w]~RBVZRi};RPxuwH\", 40, 30);\n```\n\n### encode\n\nImplented, aim to be published in 0.3.0\n\n## About the setup\n\n[**Based on the rust wasm-pack template**][template-docs]\n\nThis template is designed for compiling Rust libraries into WebAssembly and\npublishing the resulting package to NPM.\n\nBe sure to check out [other `wasm-pack` tutorials online][tutorials] for other\ntemplates and usages of `wasm-pack`.\n\n[tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html\n[template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html\n\n## 🚴 Usage\n\n### 🛠️ Build with `wasm-pack build`\n\n```\nwasm-pack build\n```\n\n### 🔬 Test in Headless Browsers with `wasm-pack test`\n\n```\nwasm-pack test --headless --firefox\n```\n\n### 🎁 Publish to NPM with `wasm-pack publish`\n\n```\nwasm-pack publish\n```\n\n## 🔋 Batteries Included\n\n- [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating\n  between WebAssembly and JavaScript.\n- [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook)\n  for logging panic messages to the developer console.\n- [`wee_alloc`](https://github.com/rustwasm/wee_alloc), an allocator optimized\n  for small code size.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffpapado%2Fblurhash-rust-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffpapado%2Fblurhash-rust-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffpapado%2Fblurhash-rust-wasm/lists"}