I want to convert SVG into bitmap images (like JPEG, PNG, etc.) through JavaScript.
Advertisement
Answer
Here is how you can do it through JavaScript:
- Use the canvg JavaScript library to render the SVG image using Canvas: https://github.com/gabelerner/canvg
- Capture a data URI encoded as a JPG (or PNG) from the Canvas, according to these instructions: Capture HTML Canvas as gif/jpg/png/pdf?