You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library has a very nice specific purpose with a convenient function signature.
However, some feedback in comparing its speed to blueimp-load-image is that browser-image-compression is much slower, e.g., compressing a 6 MB png to 2 MB takes less than a second with blueimp-load-image, whereas it takes around 10 seconds with browser-image-compression.
For reference here is the code in blueimp-load-image to compress to a specific size:
constimage=awaitloadImage(file,{orientation: true})// We reduce by an extra 10%, because for some reason the theoretical compression factor// is still a little too high. Maybe there's overhead?constcompressFactor=Math.sqrt(maxFileSize/file.size)*.9constcanvas=awaitloadImage.scale(image.image,{maxWidth: image.originalWidth!*compressFactor,maxHeight: image.originalHeight!*compressFactor,canvas: true})returnawaitnewPromise<File>(resolve=>{canvas.toBlob(blob=>resolve(newFile([blob!],file.name,{type: file.type})),file.type)})
The text was updated successfully, but these errors were encountered:
This library has a very nice specific purpose with a convenient function signature.
However, some feedback in comparing its speed to blueimp-load-image is that browser-image-compression is much slower, e.g., compressing a 6 MB png to 2 MB takes less than a second with blueimp-load-image, whereas it takes around 10 seconds with browser-image-compression.
For reference here is the code in blueimp-load-image to compress to a specific size:
The text was updated successfully, but these errors were encountered: