Socket
Socket
Sign inDemoInstall

svg2png

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg2png - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

24

lib/converter.js

@@ -23,9 +23,16 @@ "use strict";

var dimensions = getSvgDimensions(page);
page.viewportSize = {
width: Math.round(dimensions.width * scale),
height: Math.round(dimensions.height * scale)
};
if (!dimensions.usesViewBox) {
page.zoomFactor = scale;
try {
var dimensions = getSvgDimensions(page);
page.viewportSize = {
width: Math.round(dimensions.width * scale),
height: Math.round(dimensions.height * scale)
};
if (dimensions.shouldScale) {
page.zoomFactor = scale;
}
} catch (e) {
console.error("Unable to calculate dimensions.");
console.error(e);
phantom.exit();
return;
}

@@ -50,2 +57,3 @@

var height = parseFloat(el.getAttribute("height"));
var hasWidthOrHeight = width || height;
var viewBoxWidth = el.viewBox.animVal.width;

@@ -75,4 +83,4 @@ var viewBoxHeight = el.viewBox.animVal.height;

return { width: width, height: height, usesViewBox: usesViewBox };
return { width: width, height: height, shouldScale: hasWidthOrHeight || !usesViewBox };
});
}
{
"name": "svg2png",
"description": "A SVG to PNG converter, using PhantomJS.",
"version": "1.0.1",
"version": "1.1.0",
"author": "Domenic Denicola <domenic@domenicdenicola.com> (http://domenic.me)",

@@ -21,6 +21,6 @@ "license": "WTFPL",

"devDependencies": {
"chai": "~1.9.0",
"chai": "~1.9.1",
"jshint": "~2.4.3",
"mocha": "~1.17.1"
"mocha": "~1.18.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc