Skip to content

Instantly share code, notes, and snippets.

View aniruddha-adhikary's full-sized avatar

Aniruddha Adhikary (Ani) aniruddha-adhikary

View GitHub Profile
@theanam
theanam / resize_image_in_frontend.js
Last active September 21, 2021 05:03
A small JavaScipt function to resize image in frontend and return a new JPEG file
/****
Creatd by Anam Ahmed (https://anam.co)
Sample Use:
document.querySelector("input[type=file]").addEventListener("change",function(e){
if(e.target.files.length){
_resample(e.target.files[0],1000,function(response){
console.log(response); // returns an object: {stats:<compression stats>,file:output file}
});
}
});