Skip to main content

Puts watermark on images using relative or absolute coordinates.

Project description

Puts watermark on images using relative or absolute coordinates.

from cv2watermark import (
    merge_image_percentage_height,
    merge_image_percentage_width,
    merge_image_percentage_height_position,
    merge_image_percentage_width_position,
    merge_image,
)

# Allowed image formats: url/path/buffer/base64/PIL/np
i2 = r"https://www.python.org/static/img/psf-logo.png"  # Transparent image from URL doesn't work! You have to download it before
i2 = r"F:\neuedownloads\psf-logo.png"
i1 = r"https://github.com/hansalemaos/screenshots/raw/main/splitted1.png"  

merg1 = merge_image(
    back=i1, front=i2, x=10, y=30, save_path="f:\\cv2mergepics\\merg1.png"
)
merg2 = merge_image_percentage_width(
    back=i1,
    front=i2,
    x=10,
    y=30,
    front_percentage_width=80,
    save_path="f:\\cv2mergepics\\merg2.png",
)
merg3 = merge_image_percentage_width_position(
    back=i1,
    front=i2,
    percentx=50,
    percenty=60,
    front_percentage_width=30,
    save_path="f:\\cv2mergepics\\merg3.png",
)
merg4 = merge_image_percentage_width(
    back=i1,
    front=i2,
    x=110,
    y=10,
    front_percentage_width=60,
    save_path="f:\\cv2mergepics\\merg4.png",
)
merg5 = merge_image_percentage_width_position(
    back=i1,
    front=i2,
    percentx=50,
    percenty=10,
    front_percentage_width=40,
    save_path="f:\\cv2mergepics\\merg5.png",
)
merg6 = merge_image_percentage_height(
    back=i1,
    front=i2,
    x=20,
    y=50,
    front_percentage_height=40,
    save_path="f:\\cv2mergepics\\merg6.png",
)
merg7 = merge_image_percentage_height_position(
    back=i1,
    front=i2,
    percentx=20,
    percenty=40,
    front_percentage_height=40,
    save_path="f:\\cv2mergepics\\merg7.png",
)

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

cv2watermark-0.10.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

cv2watermark-0.10-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

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