1.1.2 • Published 7 years ago

img-convert v1.1.2

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

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 conversion

  • targetPath <string> path to converted image file

  • params <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))