yaic (just another image clipper)
Takes a (css transformed) image and clips it to to a given area.
Quick start
npm install yaicbower install yaic
<!-- for jQuery support see this one -->
Parameter
the yaic function takes 2 Parameter:
- img: instance of HTMLImageElement or Javascript Image Object
- area: object with the following properties
- width: width of the clipping area
- height: height of the clipping area
- targetWidth: width of resulting image
- targetHeight: height of resulting image
- x: translation of clipping area
- y: translation of clipping area
Note: targetWidth
and targetHeight
can be dropped. yaic then calculates the clipping area without scaling the orginal image at all which means you get the best possible quality.
Make sure, the ratio of width/height
equals the ratio of targetWidth/targetHeight
.
yaic does not support skew!