tsayen/dom-to-image ? reverse-engineered prompt

Reverse engineered prompt

Build me a small JavaScript library that can take any DOM element and turn it into an image.

I want it to work in the browser and let me call simple helpers like getting a PNG, JPEG, SVG, blob, or raw pixel data from a node. It should keep the styling as close as possible to what I see on screen, including fonts and normal images, and it should support an option to filter out certain elements or tweak things like background color, size, quality, and extra styles before rendering.

Please make it easy to use with both import and require, and also usable from a script tag as a global. If you need to, look up current docs online for any tricky browser behavior. Add a few examples and basic tests so I can see it working.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab