Skip to content

Commit

Permalink
fix #6
Browse files Browse the repository at this point in the history
  • Loading branch information
kabuspl committed Jan 1, 2024
1 parent 2719352 commit f8a6d73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function searchBlob (img, msg) {
}else{
search(blob);
}
});
}, "image/webp");
}

imgEl.src = img;
Expand All @@ -73,7 +73,7 @@ async function compress(canvas, ctx, img, x, y) {
canvas.width=canvas.width/2;
canvas.height=canvas.height/2;
ctx.drawImage(img,x,y,canvas.width,canvas.height);
const blob = await new Promise(resolve => canvas.toBlob(resolve));
const blob = await new Promise(resolve => canvas.toBlob(resolve, "image/webp"));
console.log(blob);
if(blob.size>20000000) {
return await compress(canvas,ctx,img,x,y);
Expand Down

0 comments on commit f8a6d73

Please sign in to comment.