stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

Implement invisible watermark according to the settings

Open MikuAuahDark opened this issue 3 years ago • 9 comments

Describe the bug Option to enable watermark doesn't working. invisible-watermark can't find any watermark on the output image!

To Reproduce Ensure "Do not add watermark to images" is unchecked. Generate any image with txt2img. Then use the invisible-watermark to extract the watermark from the resulting image. No watermark is detected.

(venv) C:\Users\MikuAuahDark\Documents\stable-diffusion-webui>python testwm.py 00006-1051346808.png
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

Expected behavior testwm.py should print some text instead of null bytes, be it "StableDiffusionV1" or something else.

Screenshots gambar

gambar

Desktop (please complete the following information):

  • OS: Windows 11 22H2 (674)
  • Browser: Firefox 105.0.3
  • Commit revision be1596ce30b1ead6998da0c62003003dcce5eb2c

Additional context While some people disagree with the existence of watermarks (#612), I myself prefer to have watermark added to my generated images.

Here's the generated image, in case it doesn't match what it generates. 00006-1051346808

1girl, pink hair, long hair, dress, green dress, long skirt, upper body
Negative prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry
Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 1051346808, Size: 512x512, Model hash: 925997e9, Clip skip: 2

Here's testwm.py, copied directly from original Stable Diffusion repository with minor modification.

import cv2
from imwatermark import WatermarkDecoder

def testit(img_path):
    bgr = cv2.imread(img_path)
    decoder = WatermarkDecoder('bytes', 136)
    watermark = decoder.decode(bgr, 'dwtDct')
    print(watermark)

if __name__ == "__main__":
    import sys
    testit(sys.argv[1])

If there's no intention on adding watermark embedding, at least remove that option from the settings.

MikuAuahDark avatar Oct 16 '22 04:10 MikuAuahDark

I just opened that image in an EXIF viewer and I can see the prompt metadata in your sample file, if this is what you mean:

1girl, pink hair, long hair, dress, green dress, long skirt, upper body Negative prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 1051346808, Size: 512x512, Model hash: 925997e9, Clip skip: 2

entmike avatar Oct 20 '22 04:10 entmike

No, that's not what I mean.

MikuAuahDark avatar Oct 20 '22 04:10 MikuAuahDark

Indeed, the option flag "do_not_add_watermark" isn't used anywhere in the code.

SteinsFu avatar Oct 27 '22 07:10 SteinsFu

https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/7510#issuecomment-1416734443

mezotaken avatar Feb 04 '23 12:02 mezotaken

On the second thought, if non-functional switch is intended, no one stops someone from implementing the actual behavior for it, if its removal is undesired, so i change this bug report to feature request.

mezotaken avatar Feb 04 '23 14:02 mezotaken

The tooltip on this setting says "Warning: if you do not add watermark, you may be behaving in an unethical manner." Not only is this weirdly opinionated and judgmental, it's ironic that it's attached to a setting that has been completely nonfunctional for at least four months.

I would recommend that if someone does someday implement this feature they should consider having it default to off, I imagine there'd be rather a tempest from people discovering that AUTOMATIC1111 is suddenly adding invisible watermarks to their images without asking them after such a long period of it not being a thing.

FaceDeer avatar Feb 18 '23 20:02 FaceDeer

I would love this. Looking for a way how to add my custom watermark.

ackvf avatar Apr 06 '23 21:04 ackvf

I would recommend that if someone does someday implement this feature they should consider having it default to off, I imagine there'd be rather a tempest from people discovering that AUTOMATIC1111 is suddenly adding invisible watermarks to their images without asking them after such a long period of it not being a thing.

A potential argument for it being watermarked with the Stable Diffusion version as originally intended is that it allows future training of models to ignore images that have been created using an older version of the model. Cropping or resizing the image will likely break the invisible watermark anyway though.

CrossBread avatar Apr 18 '23 22:04 CrossBread

True. It's not like the watermark can be used to trace it back to the source (a.k.a. who "made" the AI image). It's just there to mark the image as AI generated and that's all.

MikuAuahDark avatar Apr 19 '23 02:04 MikuAuahDark

What is the nature of the watermark anyway?

ackvf avatar Apr 28 '23 05:04 ackvf

There is no watermark. The fake checkbox is removed in 1.1

ClashSAN avatar May 02 '23 05:05 ClashSAN

Ah, so sad. I actually wanted to add watermark to my art.

ackvf avatar May 20 '23 01:05 ackvf

So, there's no watermark now?

Erickrus avatar May 31 '23 02:05 Erickrus

There never was. The checkbox wasn't hooked up to anything.

FaceDeer avatar May 31 '23 05:05 FaceDeer

I will probably never understand the decision to add it there in the first place 🤣, such a funny, sad and confusing easteregg. So many human hours were burned on this.

ackvf avatar Jun 06 '23 14:06 ackvf

It appears https://github.com/huggingface/diffusers smuggled it back in by default to SDXL: https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/sdxl.md

If the invisible-watermark library is installed, it is used by default. To disable the watermarker: pipeline = StableDiffusionXLPipeline.from_pretrained(..., add_watermarker=False)

So doing nothing and installing the lib causes it to be used.

paboum avatar Sep 20 '23 00:09 paboum

Have there been any updates on this? When I launch A111, I see this. 2023-11-07_9-19-47

tommcg avatar Nov 07 '23 15:11 tommcg