@shotstack/shotstack-canvas 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entry.web.js +15 -7
- package/package.json +1 -1
package/dist/entry.web.js
CHANGED
|
@@ -2830,13 +2830,21 @@ async function renderSvgToPng(svgString, options = {}) {
|
|
|
2830
2830
|
resvgOptions.fitTo = { mode: "height", value: options.height };
|
|
2831
2831
|
}
|
|
2832
2832
|
const resvg = new Resvg(svgString, resvgOptions);
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2833
|
+
try {
|
|
2834
|
+
const rendered = resvg.render();
|
|
2835
|
+
try {
|
|
2836
|
+
const png = rendered.asPng();
|
|
2837
|
+
return {
|
|
2838
|
+
png,
|
|
2839
|
+
width: rendered.width,
|
|
2840
|
+
height: rendered.height
|
|
2841
|
+
};
|
|
2842
|
+
} finally {
|
|
2843
|
+
rendered.free();
|
|
2844
|
+
}
|
|
2845
|
+
} finally {
|
|
2846
|
+
resvg.free();
|
|
2847
|
+
}
|
|
2840
2848
|
}
|
|
2841
2849
|
function shapeToSvgString(asset, defaultWidth, defaultHeight) {
|
|
2842
2850
|
if (!asset.shape) {
|
package/package.json
CHANGED