Clip out transparent pixels from an image
Converts an image or canvas like this:
to a canvas with the edges clipped off:
npm install semibran/image-clip
const clip = require('image-clip')
clip(image, rect*) // => HTMLCanvasElement
Get the clipped version of an Image
or HTMLCanvasElement
. If rect
is not provided, clip.bounds
will be used instead.
clip.bounds(image) // => Rect
Get the relative bounding box of a prospective clipped image in the form { x, y, width, height }
. See semibran/rect
for more details.
MIT