0.1.0 • Published 8 years ago
img-split v0.1.0
img-split
Split an
<img>into equally-sized parts

install
npm install img-splitusage
const split = require('img-split')
const load = require('img-load')
load('./tiles.png', (error, image) => {
if (error) throw error
var tiles = split(image, 16, 16)
for (var tile of tiles) {
document.body.appendChild(tile)
}
})images = split(image, width, height)
Splits image into individual <canvas> elements of the dimensions described by width and height.
image: TheHTMLImageElementto be splitwidth: The desired width of each resulting<canvas>elementheight: The desired height of each resulting<canvas>element
license
0.1.0
8 years ago