merge-images
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -21,6 +21,3 @@ // Defaults | ||
var canvas = options.Canvas ? new options.Canvas() : window.document.createElement('canvas'); | ||
var Image = options.Canvas ? options.Canvas.Image : window.Image; | ||
if (options.Canvas) { | ||
options.quality *= 100; | ||
} | ||
var Image = options.Image || window.Image; | ||
@@ -61,3 +58,3 @@ // Load sources | ||
// Resolve data URI for node-canvas jpeg async | ||
return new Promise(function (resolve) { | ||
return new Promise(function (resolve, reject) { | ||
canvas.toDataURL(options.format, { | ||
@@ -68,3 +65,4 @@ quality: options.quality, | ||
if (err) { | ||
throw err; | ||
reject(err); | ||
return; | ||
} | ||
@@ -71,0 +69,0 @@ resolve(jpeg); |
@@ -27,6 +27,3 @@ (function (global, factory) { | ||
var canvas = options.Canvas ? new options.Canvas() : window.document.createElement('canvas'); | ||
var Image = options.Canvas ? options.Canvas.Image : window.Image; | ||
if (options.Canvas) { | ||
options.quality *= 100; | ||
} | ||
var Image = options.Image || window.Image; | ||
@@ -67,3 +64,3 @@ // Load sources | ||
// Resolve data URI for node-canvas jpeg async | ||
return new Promise(function (resolve) { | ||
return new Promise(function (resolve, reject) { | ||
canvas.toDataURL(options.format, { | ||
@@ -74,3 +71,4 @@ quality: options.quality, | ||
if (err) { | ||
throw err; | ||
reject(err); | ||
return; | ||
} | ||
@@ -77,0 +75,0 @@ resolve(jpeg); |
{ | ||
"name": "merge-images", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "Easily compose images together without messing around with canvas", | ||
@@ -46,3 +46,3 @@ "main": "dist/index.umd.js", | ||
"camelcase": "^5.0.0", | ||
"canvas": "^1.6.2", | ||
"canvas": "^2.6.1", | ||
"coveralls": "^3.0.0", | ||
@@ -49,0 +49,0 @@ "datauri": "^1.0.5", |
@@ -105,6 +105,7 @@ # merge-images | ||
const mergeImages = require('merge-images'); | ||
const Canvas = require('canvas'); | ||
const { Canvas, Image } = require('canvas'); | ||
mergeImages(['./body.png', './eyes.png', './mouth.png'], { | ||
Canvas: Canvas | ||
Canvas: Canvas, | ||
Image: Image | ||
}) | ||
@@ -111,0 +112,0 @@ .then(b64 => ...); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
180
21808
140