Image resizer for browser with HTML5 canvas, it uses no external library only uses the HTML5 Canvas to crop the image and output base64 image data
NOTE: the width and height of the canvas is determined by the id of the div provided if the height of the div not provided the height will be calculated accordingly with respect to aspect ratio
- Restructure the code for better readability
- Add support for fixed width cropping
https://cdn.jsdelivr.net/npm/html-canvas-img-resizer/browser/html-canvas-img-resizer.min.js
npm i html-canvas-img-resizer
or
yarn add html-canvas-img-resizer
const imageResizer = htmlCanvasImgResizer.default(options);