Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

Investigate replacing puppeteer with smaller alternative #148

Closed
styfle opened this issue Feb 15, 2021 · 11 comments
Closed

Investigate replacing puppeteer with smaller alternative #148

styfle opened this issue Feb 15, 2021 · 11 comments
Labels
enhancement New feature or request

Comments

@styfle
Copy link
Member

styfle commented Feb 15, 2021

We are bumping up against the 50MB limit when upgrading dependencies since chromium continues to get larger.
This was discovered in a PR that was bumping dependencies: #147
We could try using a different tool to reduce the size.

HTML => PNG

The developer authors HTML and we convert to PNG with a browser, for example:

SVG => PNG

The developer authors SVG and we convert to PNG with a library, for example:

@styfle styfle added the enhancement New feature or request label May 5, 2021
@JavierMartinz

This comment has been minimized.

@styfle

This comment has been minimized.

@marklawlor

This comment has been minimized.

@styfle

This comment has been minimized.

@marklawlor

This comment has been minimized.

@styfle styfle changed the title Investigate replacing puppeteer with wkhtmltoimage Investigate replacing puppeteer with smaller alternative Nov 14, 2021
@jemgold

This comment has been minimized.

@leerob
Copy link
Member

leerob commented Jan 7, 2022

@jongold we're testing a few approaches right now! Check out the latest pulls https://github.com/vercel/og-image/pulls

@styfle styfle pinned this issue Jan 13, 2022
@AmreshSinha
Copy link

You can also give node-canvas a try

@yisibl
Copy link

yisibl commented Jan 25, 2022

I've put together a table, plus there's a Wiki test suite with more detailed edge cases for further comparison: https://commons.wikimedia.org/wiki/User:JoKalliauer/SVG_test_suites/resvg_Issues_details

Engine & binding resvg & resvg-js sharp & librsvg skia & skr-canvas
language Rust Rust/C++ Rust/C++
Features Lightweight and fast. SVG1.1 best compatibility Full CSS3 selector support, <text> support is poor Less support for SVG and CSS selectors

resvg(resvg-js) and librsvg(sharp) each have their own strengths, with librsvg being a bit faster with new features and bug fixes after migrating to Rust, but no crate has been released yet. resvg-js can easily achieve dual-engine rendering in the future, thanks to napi-rs's good architecture, to complement each other.

@weolar
Copy link

weolar commented Mar 24, 2022

hi, you can use miniblink: https://github.com/weolar/miniblink49

@styfle
Copy link
Member Author

styfle commented Oct 10, 2022

We decided that embedding a browser is not a sustainable solution.

So we built an alternative solution to convert HTML/CSS to PNG.

Check out https://vercel.com/blog/introducing-vercel-og-image-generation-fast-dynamic-social-card-images

@styfle styfle closed this as completed Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants