Home

Awesome

sorl-watermark

sorl-watermark adds support for adding watermarks to sorl-thumbnail.

Tested with:

Of course everything is configurable, from the watermark image to position and opacity.

sorl-watermark does not ship with support for generating text-based watermarks.

Setup

Install via pip

$ pip install sorl-watermark

Change sorl's thumbnail engine to one from sorl-watermark. PIL and imagemagick are supported.

PIL:

# PIL is the most well tested backend.
THUMBNAIL_ENGINE = 'sorl_watermarker.engines.pil_engine.Engine'

Pgmagick:

# PIL is the most well tested backend.
THUMBNAIL_ENGINE = 'sorl_watermarker.engines.pgmagick_engine.Engine'

Next up, you tell it which image should be used as a watermark. Note that this file has to live somewhere inside STATIC_ROOT.

THUMBNAIL_WATERMARK = 'my_watermark.png'

That's it for a simple setup. The engine will only apply the watermark if the thumbnail size is big enough.

See Advanced Usage for ways to dynamically change the watermark itself, it's size or ways to selectively apply watermarks.

Advanced Usage

sorl-watermark adds additional options to the {% thumbnail %} templatetag.

The following new options are available:

Settings Reference

The following settings are available