3.3.0 • Published 3 years ago
responsimage v3.3.0
responsimage
Create an array of images from a single input
Install
yarn add responsimageUsage
const responsimage = require('responsimage')
responsimage('http://lorempixel.com/1200/600/', {
name: 'my-image',
dir: './out',
}).then(({ color: { rgb, hex, hsl }, images }) => {
// rgb: [ 168, 182, 187 ]
// hex: #a8b6bb
// images: […]
})API
responsimage(input, options)
input
Type: String|Buffer
- a
Buffercontaining JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data - a
Stringcontaining the path to an JPEG, PNG, WebP, GIF, SVG or TIFF image file - an
URLpointing to an image resource
options
Type: Object
diroutput folder (String) default:./webpadd.webpfiles (Boolean) default:falsenameoutput images name (String) default:outfileTypeoutput images type (String) default:jpgsteps([Object]) defaultdefaultSteps*quiethide console messages (Boolean) default:falseStep shape
stepNameshown in verbose console (String)sizesize to process ([width, height])suffixto add toname(String)
*defaultSteps
const defaultSteps = [ { stepName: '2x BIG Images', size: [960, 836], suffix: '_retina', }, { stepName: '1x BIG Images', size: [540, 470], }, { stepName: '2x SMALL Images', size: [750, 653], suffix: '_small_retina', }, { stepName: '1x SMALL Images', size: [375, 326], suffix: '_small', }, ]
Extras
const { retinify } = require('responsimage')
retinify(input, size, [options])const { getColor } = require('responsimage')
getColor(input)
// { rgb, hex, hsl }License
MIT © Lionel T