KiwiKilian / eleventy-plugin-og-image

Create Open Graph images in Eleventy using your templates, data and CSS. Fast and reproducible, without a headless browser.
MIT License
52 stars 3 forks source link

Sharper resolution option #114

Closed davidpmccormick closed 1 year ago

davidpmccormick commented 1 year ago

The images look a bit less crisp than I'd like. I see that the default Sharp png compression is 6 (out of 9) – is that what's used here? Is there an option to change it?

Thanks!

davidpmccormick commented 1 year ago

Just realised I can include a sharpOptions block in the config. Sorted. Maybe it should get a mention in the README?

Actually I don't think the image compression issue is a problem with the output pngs in any event, but with some downsampling by the service I'm using to render them.

Cheers

KiwiKilian commented 1 year ago

Thanks for reporting! sharpOptions is totally missing in the docs, I will add it!

But compressionLevel shouldn't change anything about sharpness of PNGs, as PNGs are lossless. It's more about speed and resulting file size. Did it change something for you?

davidpmccormick commented 1 year ago

I couldn't see any changes – I think the issue is maybe with some downsampling where it's being used. Or maybe I'm being too fussy!

KiwiKilian commented 1 year ago

sharpOptions are now documented via https://github.com/KiwiKilian/eleventy-plugin-og-image/commit/c46bd840d21500317dd8a810093539f725372a81.

I also experimented a bit with the sharpness and different options of resvg-js and sharp – there is nothing to actually improve anymore. Output on https://og-playground.vercel.app/ looks equally crisp on same resolutions.