img-extract

tiny subimage extractor

Usage no npm install needed!

<script type="module">
  import imgExtract from 'https://cdn.skypack.dev/img-extract';
</script>

README

img-extract

tiny subimage extractor

usage

npm badge

extract(image, x, y, width, height) -> canvas

Extracts a canvas from the provided image and x, y, width, height region.

  • image: The source image of type CanvasImageSource
  • x: The x-coordinate offset of the subimage in pixels
  • y: The y-coordinate offset of the subimage in pixels
  • width: The width of the subimage in pixels
  • height: The height of the subimage in pixels
  • canvas: The subimage, of type HTMLCanvasElement