# blurhash-from-url

> Simple utility to generate blurhash from Image URL

Latest version **0.0.10** (published 2024-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install blurhash-from-url
pnpm add blurhash-from-url
yarn add blurhash-from-url
bun add blurhash-from-url
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2024-08-09 |
| First published | 2022-08-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 18 |
| Author | mcnaveen |
| Maintainers | mcnaveen |
| Keywords | blurhash, optimization, bundle, sharp, plaiceholder, blurhash-from-url |

## Links

- npm: https://www.npmjs.com/package/blurhash-from-url
- Repository: https://github.com/mcnaveen/blurhash-from-url
- Homepage: https://github.com/mcnaveen/blurhash-from-url#readme
- Issues: https://github.com/mcnaveen/blurhash-from-url/issues
- npm.io page: https://npm.io/package/blurhash-from-url

## Dependencies (4)

- [sharp](https://npm.io/package/sharp.md) ^0.30.7
- [blurhash](https://npm.io/package/blurhash.md) ^1.1.5
- [image-size](https://npm.io/package/image-size.md) ^1.0.2
- [node-fetch](https://npm.io/package/node-fetch.md) 2.6.7

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.10 (latest) — 2024-08-09
- 0.0.9 — 2024-08-09
- 0.0.8 — 2023-09-14
- 0.0.7 — 2023-07-11
- 0.0.6 — 2023-01-11
- 0.0.5 — 2022-09-05
- 0.0.5-beta.0 — 2022-09-05
- 0.0.4 — 2022-08-31
- 0.0.3 — 2022-08-25
- 0.0.2 — 2022-08-25
- 0.0.1 — 2022-08-25

## README

# Generate Blurhash from Image URL

:unicorn: Simple utility to generate blurhash from Image URL

![Test](https://github.com/mcnaveen/blurhash-from-url/workflows/Test/badge.svg)
![Downloads this Week](https://img.shields.io/npm/dw/blurhash-from-url)
![Bundle Size](https://img.shields.io/bundlephobia/min/blurhash-from-url)
![Version](https://img.shields.io/npm/v/blurhash-from-url)

![Blurhash from URL](./image/cover.png)

### :package: Requirements

- Node.js 16X LTS or Higher 📦

### :sparkles: Installation

- Install the NPM Package with the below command:

```
npm install blurhash-from-url --save
```

(or)

- Install with Yarn:

```
yarn add blurhash-from-url
```

### :bulb: Usage Example

- Import it in your project
- Pass the URL of the image
- Make sure to use Async/Await function

```javascript
//ES6 Import
import { blurhashFromURL } from "blurhash-from-url";

// Commonjs Import
// const { blurhashFromURL } = require("blurhash-from-url");

async function getBlurhash() {
  const output = await blurhashFromURL("https://i.imgur.com/NhfEdg2.png");
  console.log(output);
}

getBlurhash();
```

### :ballot_box_with_check: Example Output

```json
{
  encoded: 'UnR.*,kW.TnPt7WBocozpJV@nMkWadofWCV@',
  decoded: Uint8ClampedArray(1440000) [
    255, 255, 251, 255, 255, 255, 251, 255, 255, 255, 251, 255,
    255, 255, 251, 255, 255, 255, 251, 255, 255, 255, 251, 255,
    255, 255, 251, 255, 255, 255, 251, 255, 255, 255, 251, 255,
    255, 255, 251, 255, 255, 255, 250, 255, 255, 255, 250, 255,
    255, 255, 250, 255, 255, 255, 250, 255, 255, 255, 250, 255,
    255, 255, 250, 255, 255, 255, 250, 255, 255, 255, 250, 255,
    255, 255, 250, 255, 255, 255, 250, 255, 255, 255, 250, 255,
    255, 255, 250, 255, 255, 255, 250, 255, 255, 255, 250, 255,
    255, 255, 250, 255,
    ... 1439900 more items
  ],
  width: 600,
  height: 600
}
```

### Optional Size Parameter

By default, the image is resized to 32x32. You can pass the size as an optional parameter.

```javascript
async function getBlurhash() {
  const output = await blurhashFromURL("https://i.imgur.com/NhfEdg2.png", {
    size: 64,
  });
  console.log(output);
}
```

---

#### :green_heart: Message

I hope you find this useful. If you have any questions, please create an issue.

---
_Source: https://npm.io/package/blurhash-from-url · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
