Spaces:
Runtime error
Runtime error
watermark
Browse files- __assets__/picsart_watermark.jpg +3 -0
- utils.py +3 -2
__assets__/picsart_watermark.jpg
ADDED
Git LFS Details
|
utils.py
CHANGED
@@ -6,6 +6,7 @@ from torchvision.transforms import Resize
|
|
6 |
import imageio
|
7 |
from einops import rearrange
|
8 |
import cv2
|
|
|
9 |
from annotator.util import resize_image, HWC3
|
10 |
from annotator.canny import CannyDetector
|
11 |
from annotator.openpose import OpenposeDetector
|
@@ -16,7 +17,7 @@ apply_canny = CannyDetector()
|
|
16 |
apply_openpose = OpenposeDetector()
|
17 |
|
18 |
|
19 |
-
def add_watermark(image, im_size, watermark_path="__assets__/
|
20 |
wmsize=16, bbuf=5, opacity=0.9):
|
21 |
'''
|
22 |
Creates a watermark on the saved inference image.
|
@@ -25,7 +26,7 @@ def add_watermark(image, im_size, watermark_path="__assets__/pair_watermark.png"
|
|
25 |
'''
|
26 |
watermark = Image.open(watermark_path).resize((wmsize, wmsize))
|
27 |
loc = im_size - wmsize - bbuf
|
28 |
-
image[
|
29 |
return image
|
30 |
|
31 |
|
|
|
6 |
import imageio
|
7 |
from einops import rearrange
|
8 |
import cv2
|
9 |
+
from PIL import Image
|
10 |
from annotator.util import resize_image, HWC3
|
11 |
from annotator.canny import CannyDetector
|
12 |
from annotator.openpose import OpenposeDetector
|
|
|
17 |
apply_openpose = OpenposeDetector()
|
18 |
|
19 |
|
20 |
+
def add_watermark(image, im_size, watermark_path="__assets__/picsart_watermark.jpg",
|
21 |
wmsize=16, bbuf=5, opacity=0.9):
|
22 |
'''
|
23 |
Creates a watermark on the saved inference image.
|
|
|
26 |
'''
|
27 |
watermark = Image.open(watermark_path).resize((wmsize, wmsize))
|
28 |
loc = im_size - wmsize - bbuf
|
29 |
+
image[loc:-bbuf, loc:-bbuf, :] = watermark
|
30 |
return image
|
31 |
|
32 |
|