dom-to-image icon indicating copy to clipboard operation
dom-to-image copied to clipboard

Feature - Watermark

Open wideawakening opened this issue 8 years ago • 6 comments

Hiya,

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

wideawakening avatar Jun 14 '16 15:06 wideawakening

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?

tsayen avatar Aug 25 '16 13:08 tsayen

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

  • src (file would come handy)
  • x,y,width,height

thx for the consideration

wideawakening avatar Sep 02 '16 10:09 wideawakening

is it possible to add some feature like this:

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

jtrod avatar Sep 18 '16 20:09 jtrod

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

cnatis avatar Mar 31 '17 18:03 cnatis

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

bizaybsnt avatar May 29 '19 10:05 bizaybsnt

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,
}

tomzweb avatar Feb 07 '22 10:02 tomzweb