Skip to content

netesf13d/picture-watermarking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

picture-watermarking

This small module contains functions useful for watermarking picture with custom text. It imlements:

  • watermarking : covering the picture with lines of a repeated text
  • single text marking : adding a text on the picture
  • imprinting and decoding tracking dots : encode some data in small dots added to the picture (similar to https://en.wikipedia.org/wiki/Printer_tracking_dots)

Usage

After picture loading and conversion to a numpy array im, obtain the picture size and dpi.

Watermark mask

fontdict = {'fontsize': 24, 'fontweight': 'bold', 'color': '0.5', 'alpha': 0.5}
mask = watermark_mask(size, dpi, 'this is a watermark', text_fontdict=fontdict, shifts=(150, 120))
img = mask_over(im, mask)

LSB steganography watermarking

fontdict = {'fontsize': 24, 'fontweight': 'bold', 'color': 'k', 'alpha': 1}
mask = watermark_mask(size, dpi, 'this is a watermark', text_fontdict=fontdict,
                      shifts=(150, 120), offsets=(0, 60))
img[:, :, :3] = (img[:, :, :3] & 0xfe) + mask

Single text mask

fontdict = {'fontsize': 24, 'fontweight': 'bold', 'color': '0.9', 'alpha': 1}
mask = watermark_mask(size, dpi, 'this is a a single text', (510, 760), text_fontdict=fontdict)
img = mask_over(img, mask)

Tracking dots mask

mask = tracking_dots_mask(size, (150, 450), date=datetime.date(1992, 1, 1),
                          text='yellow dots', rgba_color=(0xff, 0xff, 0x0, 0x40))
img = mask_over(img, mask)

Dependencies

About

Add watermarking to pictures

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages