Random watermarking variation

main
Bob Mottram 2024-07-25 19:35:45 +01:00
parent 11dd9c0e3c
commit 94c9e63a52
2 changed files with 6 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -789,6 +789,11 @@ def apply_watermark_to_image(base_dir: str, nickname: str, domain: str,
get_image_dimensions(post_image_filename)
if not watermark_image_width or not watermark_image_height:
return False
watermark_width_percent += randint(-5, 5)
if watermark_width_percent < 0:
watermark_width_percent = 0
if watermark_width_percent > 100:
watermark_width_percent = 100
scaled_watermark_image_width = \
int(post_image_width * watermark_width_percent / 100)
scaled_watermark_image_height = \
@ -811,6 +816,7 @@ def apply_watermark_to_image(base_dir: str, nickname: str, domain: str,
'northeast', 'northwest',
'southeast', 'southwest'])
watermark_opacity += randint(-5, 5)
if watermark_opacity < 0:
watermark_opacity = 0
if watermark_opacity > 100: