Install
npm install --save dom-copy-image
Usage
dom copy! Copy Image Make thumbnail
copyImage(source, destination, options) -> Promise
The destination, and options arguments are optional.
Resolved value from the promise is an object
value.file = String;
value.dataURL = String;
value.destination = String;
options
options.width / options.height = Integer
Sets the output dimensions. These should be integers in pixels. Only one needs to be set.
options.ratio = Boolean
The default is true. Should the output preserve it's dimension ratio?
options.type = String
The default is image/png. What image type should the output be?
options.quality = Integer
An integer between 0, and 1. What quality should the output image have?
About
This module only works in a client DOM environment that can use node/iojs modules. For instance it will work well with electron.
It can copy images, but if you don't specify a destination you can just use it as a resize function getting back a dataURL from the resolved promise to use as a img
tag src
.