given an original width, height, and a max width and height, scale to the maximum size while maintaining original ratio
JavaScript
Switch branches/tags
Nothing to show
Latest commit faeb6a7 Oct 9, 2013 @bmcmahen initial commit
Permalink
Failed to load latest commit information.
.gitignore
History.md
Makefile
Readme.md
component.json
index.js

Readme.md

scale-to-bounds

given an original width, height, and a max width and height, scale to the maximum size while maintaining original ratio

Installation

Install with component(1):

$ component install bmcmahen/scale-to-bounds

Use

scale(originalWidth, originalHeight, maxWidth, maxHeight);

Example

var scale = require('scale-to-bounds');
var dimensions = scale(100, 200, 800, 600);
// dimensions.width = maxwidth
// dimensions.height = maxheight

License

MIT