1.1.0 • Published 2 years ago
lowpoly-palette-cover v1.1.0
Lowpoly Palette Cover
Generate a low-poly background image from another image's color palette.
Motivation
Low-poly images are a nice way to inject some vibrant life to an otherwise boring design. If you want to generate them dynamically there are multiple ways to do it but none that can take an image and generate a low-poly background based on the image's color palette, until now!
Usage
Installation
yarn add lowpoly-palette-cover
Usage
import LowpolyCover from 'lowpoly-palette-cover'
const opts = {
width: 500,
height: 500
};
// Get image as data URI
LowpolyCover.from('/path/to/image', opts).asSVG().then((svg) => { /* do something with svg */ })
LowpolyCover.from('/path/to/image', opts).asPNG().then((png) => { /* do something with png */ })
// Get the canvas element directly
LowpolyCover.from('/path/to/image').asCanvas().then((canvas) => { /* do something with canvas */ })
// Obtain image palette (output of node-vibrant)
LowpolyCover.from('/path/to/image').getPalette().then((palette) => { /* do something with palette */ })