Here's a blog post detailing how this works (using @vercel/og): https://vercel.com/blog/introducing-vercel-og-image-generati...
Here's a blog post detailing how this works (using @vercel/og): https://vercel.com/blog/introducing-vercel-og-image-generati...
Looks like using Satori might have been easier to use then having to do all the canvas draw calls (which isn't all that bad either though).
Edit: Nevermind. Actually looks like this wouldn't be self hostable in a github action. vercel/og doesn't run in a node runtime?
vercel/og (a wrapper around Satori) does not support node
Could be a (convoluted?) way to ensure an asset looks the same across all browsers..
https://vercel.com/docs/concepts/functions/edge-functions/og...
For anyone else who’s curious it looks like the pertinent source[1] can be self-hosted. I’m on mobile so I’m gonna limit my peering into the source, but it appears to wrap Chromium to do the PNG generation. Quite a bit different from my solution (which takes SVG-producing JSX and anything producing CSS, and renders to PNG with Sharp).
I’m curious how much overhead using Chromium adds, and whether alternatives like Sharp were considered.
I recently made image export on some SVG charts that you could download as SVG and PNG and I was quite pleased I managed to do it without any library
My use cases are all very unusual, but they’d probably make portability a much simpler task because I hobbled together such a weird set of technologies.