Package Exports
- aspectratio
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aspectratio) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
aspectratio
Image aspect ratio utilities.
Install
npm install aspectratio --save
API
var aspect = require('aspectratio');
fixed(integer width
, integer height
, string ratio
)
Apply a fixed aspect ratio
without distoring the image.
- integer
width
- original image width - integer
height
- original image height - string
ratio
- new image ratio
Return
This will return an Array
of four values:
- integer
x
- top lef x coordinate - integer
y
- top lef y coordinate - integer
width
- new image width - integer
height
- new image height
Example
var crop = aspect.fixed(2048, 768, '4:3');
// [512, 768, 1024, 768]