Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

semibran/img-split

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

img-split

Split an <img> into equally-sized parts

Super Mario Bros. overworld tileset split into 16x16 fragments

install

npm install img-split

usage

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: The HTMLImageElement to be split
  • width: The desired width of each resulting <canvas> element
  • height: The desired height of each resulting <canvas> element

license

MIT © Brandon Semilla

About

Split an <img> into equally-sized parts

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published