@ogify/core 0.1.2 → 0.1.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/index.js +2 -1
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -344,13 +344,14 @@ async function renderTemplate(template, params, options) {
|
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
346
|
});
|
|
347
|
-
const
|
|
347
|
+
const resvg = new resvgJs.Resvg(svg, {
|
|
348
348
|
fitTo: {
|
|
349
349
|
mode: "width",
|
|
350
350
|
// Scale based on width, maintain aspect ratio
|
|
351
351
|
value: width
|
|
352
352
|
}
|
|
353
353
|
});
|
|
354
|
+
const pngData = resvg.render();
|
|
354
355
|
return Buffer.from(pngData.asPng());
|
|
355
356
|
}
|
|
356
357
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import satori from 'satori';
|
|
2
2
|
import { html } from 'satori-html';
|
|
3
|
-
import {
|
|
3
|
+
import { Resvg } from '@resvg/resvg-js';
|
|
4
4
|
|
|
5
5
|
// src/template.ts
|
|
6
6
|
|
|
@@ -338,13 +338,14 @@ async function renderTemplate(template, params, options) {
|
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
});
|
|
341
|
-
const
|
|
341
|
+
const resvg = new Resvg(svg, {
|
|
342
342
|
fitTo: {
|
|
343
343
|
mode: "width",
|
|
344
344
|
// Scale based on width, maintain aspect ratio
|
|
345
345
|
value: width
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
|
+
const pngData = resvg.render();
|
|
348
349
|
return Buffer.from(pngData.asPng());
|
|
349
350
|
}
|
|
350
351
|
|