compress image on browser
compressImage(file, callback)
File
, file comes generally from <input type="file" />
execute the callback after compressing image. callback(newFile)
File
, the file compressed
var compressImage = require('image-compress-browser');
compressImage(file, function (newFile) {
console.log('file:', file.size, 'newFile', newFile.size);
});
<script src="./node_modules/image-compress-browser/dist/compressImage.js"></script>
<script>
compressImage(file, function (newFile) {
console.log('file:', file.size, 'newFile', newFile.size);
});
</script>
release v1