Skip to content

Instantly share code, notes, and snippets.

View movahhedi's full-sized avatar
💻
Coding, probably.

Shahab Movahhedi movahhedi

💻
Coding, probably.
View GitHub Profile
@movahhedi
movahhedi / image-resize.js
Created June 21, 2023 15:11 — forked from daviesesiro/image-resize.js
a minimal function to resize an image on the browser in JavaScript
/**
* Resizes an Image File and converts it to a dataurl string.
* @param imageFile the image file (probably from a file input)
* @param resize_width The width you want the image to be
* @param quality quality of the resize image 0 - 1
*/
const resizeImage = ({
resizeWidth = 400,
imageFile,
quality = 1,