Skip to content

Commit efcc4eb

Browse files
committed
perf: pass SVG data directly to sharp for JPEG's
1 parent 3967bfb commit efcc4eb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/runtime/server/og-image/satori/renderer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ async function createJpeg(event: OgImageRenderEventContext) {
8181
const png = await createPng(event)
8282
const sharp = await useSharp()
8383
return sharp(png, defu(event.options.sharp, sharpOptions)).jpeg().toBuffer()
84+
return sharp(svgBuffer, defu(event.options.sharp, sharpOptions))
85+
.jpeg(sharp as JpegOptions)
86+
.toBuffer()
8487
}
8588

8689
const SatoriRenderer: Renderer = {

0 commit comments

Comments
 (0)