@e-group/utils
Version:
eGroup team utils that share across projects.
21 lines (20 loc) • 744 B
TypeScript
export default preProcessImage;
/**
* Compress and resize image and keep aspect ratio.
*
* @param {node} canvas Canvas element
* @param {node} img Image element
* @param {object} options
* @param {string} options.type ['image/jpeg'] compressed image type
* @param {number} options.quality [1] compressed image quality
* @param {number} options.maxWidth [1920] compressed image max width
* @param {number} options.maxHeight [1920] compressed image max height
* @param {boolean} options.orientation provide image orientation to reset it
*/
declare function preProcessImage(canvas: any, img: any, options: {
type: string;
quality: number;
maxWidth: number;
maxHeight: number;
orientation: boolean;
}): Promise<any>;