Skip to content

trhall/saveSvgAsPng

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

saveSvgAsPng

To save a PNG, include the script saveSvgAsPng.js in your page, then call the saveSvgAsPng function with an SVG node, a filename, and an optional scaling factor:

saveSvgAsPng(document.getElementById("diagram"), "diagram.png", 3);

If you just want a dataURI for an SVG, you can call svgAsDataUri with an SVG node, a scaling factor, and a callback:

svgAsDataUri(document.getElementById("diagram"), 1, function(uri) {
  ...
});

Compatible with browserify.

About

Save SVGs as PNGs from the browser.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%