Skip to content

semibran/img-tile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

img-tile

tile an <img> from a given width and height

mario tileset split into 16x16 fragments

const tile = require("img-tile")
const load = require("img-load")

load("./tiles.png", (err, image) => {
  if (err) throw err
  let tiles = tile(image, 16, 16)
  for (let tile of tiles) {
    document.body.appendChild(tile)
  }
})

usage

npm badge

tile(image, width, height) -> images

Splits the given 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

About

tile an <img> from a given width and height

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published