MCPcopy Create free account
hub / github.com/pollinations/pollinations / rasterize

Function rasterize

tools/icons/src/render.js:68–75  ·  view source on GitHub ↗
(svg, color, w, h)

Source from the content-addressed store, hash-verified

66
67// Tint an SVG and rasterize it to fit within w×h (transparent); return {buf,w,h}.
68async function rasterize(svg, color, w, h) {
69 const buf = await sharp(Buffer.from(tintLogo(svg, color)))
70 .resize(w, h, { fit: "inside", background: TRANSPARENT })
71 .png()
72 .toBuffer();
73 const m = await sharp(buf).metadata();
74 return { buf, w: m.width, h: m.height };
75}
76
77/**
78 * OG card: the brand lockup STACKED — the lotus mark above the "pollinations.ai"

Callers 1

renderOgFunction · 0.85

Calls 1

tintLogoFunction · 0.85

Tested by

no test coverage detected