# resemble-image

> Provide color stops for a gradient that loosely resembles the original image.

Latest version **1.0.2** (published 2019-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install resemble-image
pnpm add resemble-image
yarn add resemble-image
bun add resemble-image
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-08-09 |
| First published | 2017-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Manuel Wieser |
| Maintainers | lorti |

## Links

- npm: https://www.npmjs.com/package/resemble-image
- Repository: https://github.com/Lorti/resemble-image
- Homepage: https://manu.ninja/thoughts-on-linear-gradients-that-resemble-images
- Issues: https://github.com/Lorti/resemble-image/issues
- npm.io page: https://npm.io/package/resemble-image

## Dependencies (2)

- [jimp](https://npm.io/package/jimp.md) ^0.2.27
- [neuquant-js](https://npm.io/package/neuquant-js.md) ^0.2.0

## Recent versions

- 1.0.2 (latest) — 2019-08-09
- 1.0.1 — 2017-01-12
- 1.0.0 — 2017-01-12

## README

# resemble-image

> Provide color stops for a gradient that loosely resembles the original image.

This package contains the algorithms `getEqualWidthStops` and `getVariableWidthStops` as described in [Thoughts on Linear Gradients That Resemble Images.][3]

![getEqualWidthStops(), getVariableWidthStops(), Original](https://manu.ninja/images/improved-gradient-misty.jpg)

``` bash
npm install resemble-image --save-dev
```

``` js
import { getEqualWidthStops, getVariableWidthStops } from 'resemble-image';
```

``` js
var getEqualWidthStops = require('resemble-image').getEqualWidthStops;
var getVariableWidthStops = require('resemble-image').getVariableWidthStops;
```

Each function returns a promise, which resolves in an array of color–position pairs.

``` js
getEqualWidthStops(image, { fidelity: 4 }).then((stops) => console.log(stops));
// [ { color: '#023d33', position: 0 },
//   { color: '#036357', position: 25 },
//   { color: '#91aaa5', position: 50 },
//   { color: '#cdcfd5', position: 75 } ]

getVariableWidthStops(image, { fidelity: 4 }).then((stops) => console.log(stops));
// [ { color: '#043630', position: 9.77 },
//   { color: '#02554b', position: 33.79 },
//   { color: '#c4c6dd', position: 67.97 },
//   { color: '#c4c6dd', position: 95.31 } ]
```

## Documentation
* [Ben Briggs' `postcss-resemble-image`][1]
* [Improving Perceived Performance with Multiple Background Images][2]
* [Thoughts on Linear Gradients That Resemble Images][3]

[1]: https://github.com/ben-eb/postcss-resemble-image
[2]: http://csswizardry.com/2016/10/improving-perceived-performance-with-multiple-background-images/
[3]: https://manu.ninja/thoughts-on-linear-gradients-that-resemble-images

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