#Can OG ImageResponse output a jpg instead of png? Want smaller file sizes

2 messages · Page 1 of 1 (latest)

sage pecan
#

Hello! I am loving vercel/og library!! 🥳

One question has come up as I'm playing around with it:

We are trying to generate og:images that are under about <300kb) (why? we're trying to get it to work as a WhatsApp preview, which requires a <300kb og:image).

We're currently creating an og:image with background-image: url(some-background.jpg) , and the some-background.jpg itself is 110kb, but when converted to a png in the ImageResponse, it ends up over 1mb.

I was wondering if there's a way to configure ImageResponse so that it creates a jpg images instead of a png, and if so, how do you configure that?

Otherwise, does anyone happen to have tips & tricks for ways to get smaller file sizes from images generated via vercel/og?

Thanks so much!!

thick sluice
#

Hey! We have an issue to track this, I think we can cut down the PNG size by ~40% if that helps