Metadata-Version: 2.5
Name: laidline-diffusers
Version: 1.1.3
Summary: `attach(pipe)` marks the images a diffusers pipeline returns (watermark, evidence, and C2PA on the signed `out.assets`) and replaces the SDXL invisible watermarker
Project-URL: Homepage, https://laidline.com
Project-URL: Documentation, https://laidline.com/docs/quickstart
Project-URL: Changelog, https://laidline.com/docs/changelog
Author: Laidline LLC
License-Expression: LicenseRef-Laidline-Source-Available
License-File: LICENSE
Keywords: ai-act,c2pa,diffusers,provenance,watermark
Classifier: Development Status :: 5 - Production/Stable
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.12
Requires-Dist: laidline[image]<2,>=1.0
Requires-Dist: numpy>=1.26
Requires-Dist: pillow>=10
Provides-Extra: diffusers
Requires-Dist: diffusers<0.41,>=0.40; extra == 'diffusers'
Requires-Dist: torch>=2.5; extra == 'diffusers'
Requires-Dist: transformers>=4.46; extra == 'diffusers'
Description-Content-Type: text/markdown

# laidline-diffusers

`attach(pipe, marker)` marks the images a diffusers pipeline returns (PixelSeal watermark by default, C2PA manifest,
evidence entry), once per image, and replaces SDXL's invisible watermarker. An image under 128 px on its
short side, or below the PSNR floor, is signed without the watermark; a flat or solid-colour image whose mark does
not read back is signed without it and logged as `unmarked`. `detach(pipe)` undoes it.

```python
from laidline import Marker
from laidline_diffusers import attach

pipe = attach(pipe, Marker.from_config("laidline.yaml"))
out = pipe(prompt="a lighthouse at dusk")
out.assets[0].save("lighthouse.png")  # the signed file: watermark and C2PA manifest
out.images[0]  # the same pixels, watermark only (a manifest cannot live in pixels)
```

- `attach` swaps the pipeline's class for a cached subclass whose `__call__` runs the original and then marks the
  output; the class name, qualname and module are kept, so `type(pipe).__name__` and `save_pretrained` are unchanged.
- `out.images` carry the watermark only, in the original type, shape and dtype; `out.assets[i]` (`MarkedAsset`) holds
  the signed bytes (`data`, `asset_id`, `manifest_id`, `save(path)`). Store or serve `asset.data`.
- SDXL's `StableDiffusionXLWatermarker` is replaced (`pipe.watermark = None`; `replace_watermarker=False` keeps it).
- A marking failure raises `MarkError`: no unmarked image is returned, apart from the cases above.

Verification: on 21 Oct 2026 on `stabilityai/stable-diffusion-xl-base-1.0` (diffusers 0.40.0,
fp16, RTX 5080): four 1024 px images, each detected as marked at grade B, with a development signing chain and unkeyed
payloads. See [the diffusers integration guide](https://laidline.com/docs/integrations/diffusers).
