mycurelabs / vue-html2canvas

Vue mixin for Html2Canvas
MIT License
116 stars 23 forks source link

Passing parameters to canvas.toDataURL() method for Image format and Quality #27

Open OrkunKocyigit opened 4 years ago

OrkunKocyigit commented 4 years ago

Would it be possible for you to expose two optional parameters for image format and image quality? By default empty method exposes png files which can be huge. It would be nice for us to provide those in options during function call instead of getting canvas and try to manipulate it.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL

canvas.toDataURL(type, encoderOptions);

type Optional A DOMString indicating the image format. The default format type is image/png. encoderOptions Optional A Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp. If this argument is anything else, the default value for image quality is used. The default value is 0.92. Other arguments are ignored.