tsayen / dom-to-image

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

Feature - Watermark #41

Open wideawakening opened 8 years ago

wideawakening commented 8 years ago

Hiya,

Any chances of having some rendering options in order to add a watermark to the resulting image?

tsayen commented 8 years ago

that looks like a possibly nice feature, but there are too many different use cases. Should it be a text? Or an image watermark? There probably should be some parameters like position, orientation, opacity and so on. Can you elaborate?

wideawakening commented 8 years ago

All what you state makes sense, but in our case we would go for image-type watermark

thx for the consideration

jtrod commented 8 years ago

is it possible to add some feature like this:

https://www.youtube.com/watch?v=CRZst_Y_WoA

cnatis commented 7 years ago

I just wanted to add that https://github.com/tsayen/dom-to-image/issues/111 could be a solution for this too

bizaybsnt commented 5 years ago

any update in this issue?? I can't use html2canvas since it doesn't render CSS properly in the image.

tomzweb commented 2 years ago

If anyone's interested, there is a method you can add a watermark using a background image in the properties style object, however, the image url has to be base64.

E.g.

{
  style: {
    padding:'100px 40px 40px 40px',
    backgroundColor: '#000',
    backgroundPosition: 'center 30px',
    backgroundSize: '140px',
    backgroundRepeat: 'no-repeat',
    backgroundImage: 'url("data:image/png;base64,<base64>"'
  },
  height: html.offsetHeight + 160,
  width: html.offsetWidth + 80,
}