javascript - Scale a Canvas so that the base64 toDataURL() is scaled as well -
i'm building chrome extension save screenshots of webpage. i've gotten screenshot pieced html5 canvas element.
if display image canvas.todataurl('image/jpeg', 0.8); works fine.
however, if try first scale image getting context , using this:
var context = canvas.getcontext('2d'); context.scale(.75,.75); and output canvas.todataurl('image/jpeg', 0.8); image same size 1 without scaling. missing? how can scale image?
if want scaled down <canvas>:
create 2nd
<canvas>width desired width , height want capturedraw 1st
<canvas>2nd<canvas>using https://developer.mozilla.org/en-us/docs/html/canvas/tutorial/using_images#scaling (canvas validdrawimage()source)save 2nd
<canvas>
Comments
Post a Comment