tsayen / dom-to-image

Generates an image from a DOM node using HTML5 canvas
Other
10.32k stars 1.68k forks source link

Can I get a transparent image? #188

Closed XiNiHa closed 6 years ago

XiNiHa commented 6 years ago

Is it possible to generate image that has transparent background?

Syndesi commented 6 years ago

Hi @anesin1109 ,

yes that's possible. To demonstrate this, I created three nodes: One contained a transparent image, the two others contain red text (one of them have a explicit transparent background). Then I used dom-to-image and loaded the created images in front of another image: screenshot-2018-2-24 transparent-dom-to-image

You can run this example yourself:

yarn install
yarn start

The website will be available under localhost:8080. transparent-dom-to-image.zip

Syndesi commented 6 years ago

Hi, can you close this issue or do you need any further help/examples? :)

XiNiHa commented 6 years ago

Oh, I'm sorry. I forgot to close the issue. It's my first issue that can be closed while using Github for 5+ years lol

Syndesi commented 6 years ago

No problem, I'm just glad that I could help you :)