1.1.2 • Published 7 years ago
img-convert v1.1.2
img-convert
Simple crossplatform converter for images.
Requires ImageMagick installed and added to PATH.
Install
npm install img-convert --save
Syntax
require('img-convert')(imgPath, targetPath[, params])
imgPath
<string>
path to image file for conversiontargetPath
<string>
path to converted image fileparams
<object>
contains execution parameters
Returns Promise
which fulfills to targetPath
.
Optionally you can specify the path for ImageMagick binary:
require('img-convert').path = "path/to/converter"
Usage
const imgConvert = require('img-convert')
imgConvert('~/picture.png', '~/thumbs/small_picture.gif', { resample: 96, resize: '50%' })
.then(targetPath => {
console.log(targetPath) // '/mnt/d/thumbs/small_picture.gif'
})
.catch(console.log.bind(console))