ctx-resize
v1.0.1
Published
Resizes a canvas
Downloads
5
Maintainers
Readme
ctx-resize
Resizes a canvas
Examples
javascript (browser)
const cResize = require('ctx-resize')
const dimensions = {
width: 900,
height: 600
}
var canvas = document.getElementById('aCanvas')
canvas.width = 1000
canvas.height = 1000
const transform = cResize(dimensions)
transform(canvas, function (err, newCanvas) {
assert(newCanvas.width === dimensions.width)
assert(newCanvas.heigth === dimensions.height)
})
Node.js
const cResize = require('ctx-resize')
const dimensions = {
width: 900,
height: 600
}
const Canvas = require('canvas')
var canvas = new Canvas(1000, 1000)
const transform = cResize(dimensions)
transform(canvas, function (err, newCanvas) {
assert(newCanvas.width === dimensions.width)
assert(newCanvas.heigth === dimensions.height)
})