spite / ccapture.js

A library to capture canvas-based animations at a fixed framerate
MIT License
3.55k stars 406 forks source link

Webm output double the size of the canvas, p5.js #116

Closed 5yF0Rc3 closed 3 years ago

5yF0Rc3 commented 4 years ago

My canvas in p5.js is 700x700, but the output of the Webm is 1400x1400. Is this normal? Can or should I change the size somewhere?

rdsilver commented 3 years ago

That is not normal, there is probably an error in your code.

You can see on 3dgifmaker.com, the webm download respects the size of canvas.

spite commented 3 years ago

If you have a 700x700 canvas with a devicePixelRatio of 2, the canvas will probably be 1400x1400. That could be one reason.

rdsilver commented 3 years ago

@spite That's a good point, you can set p5.js to p5.pixelDensity(1) to potentially fix it 5yF0R

5yF0Rc3 commented 3 years ago

I haven't worked on that project for a while and it seems it resolved itself. However, with pixelDensity(2) the output of Webm would really be 2 times the size.