@e-group/utils
Version:
eGroup team utils that share across projects.
12 lines (11 loc) • 494 B
TypeScript
/**
* Conserve aspect ratio of the original region. Useful when shrinking
* images to fit into a certain area.
*
* @param {Number} srcWidth width of source image
* @param {Number} srcHeight height of source image
* @param {Number} maxWidth maximum available width
* @param {Number} maxHeight maximum available height
* @return {Object} { width, height }
*/
export default function calculateAspectRatioFit(srcWidth: number, srcHeight: number, maxWidth: number, maxHeight: number): any;