Skip to content

semibran/image-clip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image-clip

Clip out transparent pixels from an image

Converts an image or canvas like this:

Before clip

to a canvas with the edges clipped off:

After clip

Installation

npm install semibran/image-clip

Usage

const clip = require('image-clip')

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.

bounds

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.

License

MIT

About

Clip out transparent pixels from an image

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published