With the code below I want to end up with:
- a 400x400 camera capture
- a 400x400 canvas
- a 400x400 image
let capture
let universalWidth = 400
let testImg = undefined
function setup() {
testImg = document.getElementById('test')
capture = createCapture({
audio: false,
video: {
width: universalWidth,
height: universalWidth
}
})
capture.size(universalWidth, universalWidth)
createCanvas(universalWidth, universalWidth)
}
function draw() {
image(capture.get(), 0, 0)
testImg.src = canvas.toDataURL()
}
Instead, what I end up with is:
- a 400x400 camera capture
- a 400x400 canvas with its
widthandheightattributes set to800 - a 800x800 image
How do I fix this ?
You can see the problem in action here