Convert SVG to PNG, JPG or WebP with JavaScript example

Select images

SVG example element

Original size in pixels: 793 width, 1122 height.

Image by Clker-Free-Vector-Images from Pixabay
Your environment

              
The toDataURL() method in HTMLCanvasElement is used to convert a canvas element into a data URL. It returns a data URL containing a representation of the image in the format specified by the type parameter. If the type parameter is not specified or if the given format is not supported, the data will be exported as image/png. However, many browsers also support additional formats including image/jpeg and image/webp.

Results