{"id":19082378,"url":"https://github.com/mad-gooze/fast-blurhash","last_synced_at":"2025-04-05T01:09:16.153Z","repository":{"id":46564405,"uuid":"349208596","full_name":"mad-gooze/fast-blurhash","owner":"mad-gooze","description":"Fast \u0026 tiny Wolt BlurHash decoder implementation","archived":false,"fork":false,"pushed_at":"2024-08-02T01:16:10.000Z","size":430,"stargazers_count":175,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T00:12:32.007Z","etag":null,"topics":["blurhash","fast","image","placeholder","tiny"],"latest_commit_sha":null,"homepage":"https://mad-gooze.github.io/fast-blurhash/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mad-gooze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-18T20:28:49.000Z","updated_at":"2025-03-18T03:51:54.000Z","dependencies_parsed_at":"2024-11-23T06:32:09.782Z","dependency_job_id":null,"html_url":"https://github.com/mad-gooze/fast-blurhash","commit_stats":{"total_commits":49,"total_committers":2,"mean_commits":24.5,"dds":"0.22448979591836737","last_synced_commit":"a43100e595149d1cd9e23933301dd17b14746eff"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mad-gooze%2Ffast-blurhash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mad-gooze%2Ffast-blurhash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mad-gooze%2Ffast-blurhash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mad-gooze%2Ffast-blurhash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mad-gooze","download_url":"https://codeload.github.com/mad-gooze/fast-blurhash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247271532,"owners_count":20911587,"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","fast","image","placeholder","tiny"],"created_at":"2024-11-09T02:43:05.816Z","updated_at":"2025-04-05T01:09:16.123Z","avatar_url":"https://github.com/mad-gooze.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fast-blurhash\n\n[![npm](https://img.shields.io/npm/v/fast-blurhash)](https://www.npmjs.com/package/fast-blurhash)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/fast-blurhash)](https://bundlephobia.com/result?p=fast-blurhash)\n\n\u003e Fast \u0026 tiny [Wolt BlurHash](https://github.com/woltapp/blurhash) decoder implementation\n\n-   🤏 **Tiny**: ≈1kb minified\n-   🚀 **Fast**: up to 70% faster then [original `blurhash.decode`](https://github.com/woltapp/blurhash/tree/master/TypeScript#decodeblurhash-string-width-number-height-number-punch-number--uint8clampedarray) (see [benchmark](./benchmark.js))\n\n[Demo](https://mad-gooze.github.io/fast-blurhash/)\n\n## Install\n\n```sh\nnpm install --save fast-blurhash\n```\n\n## API\n\n### decodeBlurHash\n\n`fast-blurhash` provides a drop-in replacement for [original `blurhash.decode`](https://github.com/woltapp/blurhash/tree/master/TypeScript#decodeblurhash-string-width-number-height-number-punch-number--uint8clampedarray)\n\n```typescript\ndecodeBlurHash(blurhash: string, width: number, height: number, punch?: number) =\u003e Uint8ClampedArray`\n```\n\n`decodeBlurHash` uses approximate calculation for speed reasons. Results may slightly differ from original `blurhash.decode` but the diff is not noticeable (see [tests](./index.test.js)).\n\n⚠️ `decodeBlurHash` does not validate input.\n\n#### Example\n\n```js\nimport { decodeBlurHash } from 'fast-blurhash';\n\n// decode blurHash image\nconst pixels = decodeBlurHash('LEHV6nWB2yk8pyo0adR*.7kCMdnj', 32, 32);\n\n// draw it on canvas\nconst canvas = document.createElement('canvas');\nconst ctx = canvas.getContext('2d');\nconst imageData = ctx.createImageData(width, height);\nimageData.data.set(pixels);\nctx.putImageData(imageData, 0, 0);\ndocument.body.append(canvas);\n```\n\n### getBlurHashAverageColor\n\n```typescript\ngetBlurHashAverageColor(blurhash: string) =\u003e [number, number, number]`\n```\n\n`getBlurHashAverageColor` returns an average color of a passed blurhash image in [red, green, blue].\n\n#### Example\n\n```js\nimport { getBlurHashAverageColor } from 'fast-blurhash';\n\n// get image average color and use it as css background color\nconst rgbAverageColor = getBlurHashAverageColor('LEHV6nWB2yk8pyo0adR*.7kCMdnj');\ndocument.body.style.backgroundColor = `rgb(${rgbAverageColor.join(',')})';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmad-gooze%2Ffast-blurhash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmad-gooze%2Ffast-blurhash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmad-gooze%2Ffast-blurhash/lists"}