Skip to main content

Library for add text watermarks to images using PIL, support sorl-thumbnail integration

Project description

Watermarker

Library for add text watermarks to images using PIL

Installation:

  • Install with pip or easy install (All dependencies will be installed automatically)

Usage:

Import watermark function from watermarker, then call watermark, providing options:

  • image (required) - PIL Image instance

  • text (required)- text to add over image

  • font_path (required)- font that will be used

  • font_scale (required or font_size provided) - watermark font size will be set as percent of image height

  • font_size (required or font_scale provided)

  • color (optional) - default (0,0,0)

  • opacity (optional) - default 0.6

  • margin (optional) - default (30, 30) - margin, in pixels, from bottom right corner of image, where watermark will be placed

sorl-thumbnail integration

Add to your settings:

THUMBNAIL_ENGINE = 'watermarker.sorl_engine.WatermarkEngine'
WATERMARK_OPTIONS = {'font_scale': 0.05, 'font_path': PATH_TO_FONT} # Any other options from watermark function
WATERMARK_MIN_SIZE = 50 #Minimum image size (max(height, width)) to add watermark

You can add:

WATERMARK_FORCE = u'watermark text' # Add watermark to all images except less than WATERMARK_MIN_SIZE

or add watermark option to thumbnail tag:

thumbnail image "1000x1000" watermark="my watermark"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

watermarker-1.0.tar.gz (2.7 kB view details)

Uploaded Source

File details

Details for the file watermarker-1.0.tar.gz.

File metadata

  • Download URL: watermarker-1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for watermarker-1.0.tar.gz
Algorithm Hash digest
SHA256 954dba1ba405c96eafaa01ea2c326f3c580dee2a993d6e43f7d647fc16647ccd
MD5 96f719b40dfb98c662738123d93ee863
BLAKE2b-256 f6f64445b3c7a713d49b65fea528aff9a9a98aa36474c5c9d57c14a8d5f3cfff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page