Downscale image before uploading
This commit is contained in:
parent
95d49daa23
commit
3381c6e165
1 changed files with 3 additions and 2 deletions
|
|
@ -127,8 +127,9 @@
|
||||||
|
|
||||||
button.addEventListener("click", () => {
|
button.addEventListener("click", () => {
|
||||||
const canvas = document.createElement("canvas");
|
const canvas = document.createElement("canvas");
|
||||||
canvas.width = video.videoWidth;
|
const scale = 384 / video.videoWidth;
|
||||||
canvas.height = video.videoHeight;
|
canvas.width = video.videoWidth * scale;
|
||||||
|
canvas.height = video.videoHeight * scale;
|
||||||
canvas
|
canvas
|
||||||
.getContext("2d")
|
.getContext("2d")
|
||||||
.drawImage(video, 0, 0, canvas.width, canvas.height);
|
.drawImage(video, 0, 0, canvas.width, canvas.height);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue