mirror of https://gitlab.com/bashrc2/epicyon
Random watermarking variation
parent
11dd9c0e3c
commit
94c9e63a52
Binary file not shown.
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 26 KiB |
6
media.py
6
media.py
|
@ -789,6 +789,11 @@ def apply_watermark_to_image(base_dir: str, nickname: str, domain: str,
|
||||||
get_image_dimensions(post_image_filename)
|
get_image_dimensions(post_image_filename)
|
||||||
if not watermark_image_width or not watermark_image_height:
|
if not watermark_image_width or not watermark_image_height:
|
||||||
return False
|
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 = \
|
scaled_watermark_image_width = \
|
||||||
int(post_image_width * watermark_width_percent / 100)
|
int(post_image_width * watermark_width_percent / 100)
|
||||||
scaled_watermark_image_height = \
|
scaled_watermark_image_height = \
|
||||||
|
@ -811,6 +816,7 @@ def apply_watermark_to_image(base_dir: str, nickname: str, domain: str,
|
||||||
'northeast', 'northwest',
|
'northeast', 'northwest',
|
||||||
'southeast', 'southwest'])
|
'southeast', 'southwest'])
|
||||||
|
|
||||||
|
watermark_opacity += randint(-5, 5)
|
||||||
if watermark_opacity < 0:
|
if watermark_opacity < 0:
|
||||||
watermark_opacity = 0
|
watermark_opacity = 0
|
||||||
if watermark_opacity > 100:
|
if watermark_opacity > 100:
|
||||||
|
|
Loading…
Reference in New Issue