vercel / satori

Enlightened library to convert HTML and CSS to SVG

Home Page:https://og-playground.vercel.app

Repository from Github https://github.comvercel/satoriRepository from Github https://github.comvercel/satori

URI-encoded bitmaps in image src not working in either SVG or PNG exports

BarakChamo opened this issue · comments

Bug report

Description / Observed Behavior

I'm trying to use a Data-URI base64 encoded BMP image as a source for an img tag with defined width and height attributes.

This doesn't work in SVG or PNG modes, but it works just fine in the HTML (Native) preview.

The error on the playground is:
Spread syntax requires ...iterable not be null or undefined

The error locally is:
Cause: TypeError: a is not iterable

I'm trying to use bitmap data URIs because I'm expecting to receive a stream of pixel data and need to be able to render it as an image without having to deal with image compression algorithms.

As you can see in the HTML preview, the bitmap encoded string works just fine in HTML as an image source, and "rendering" a pixel stream to a bitmap base64 Data URI can be done with as little as 30 lines of code, which is why I'd like to stick to this image format.

Expected Behavior

I expected Satori to be able to render base64-encoded data URIs of bitmap images, just like it can do with PNGs and JPGs (verified working just fine).

Reproduction

Playground reproduction link - BMP, not working

Playground reproduction link - PNG, working fine

Additional Context

Locally I'm using the ImageResponse from next/og with next@^15