lev1 commited on
Commit
450e8ba
1 Parent(s): 714bf26
Files changed (2) hide show
  1. __assets__/picsart_watermark.jpg +3 -0
  2. utils.py +3 -2
__assets__/picsart_watermark.jpg ADDED

Git LFS Details

  • SHA256: 692c3050ed540ad5fca9a1cc9d2993306332cb5ca84daf7bef779276d270ea2c
  • Pointer size: 130 Bytes
  • Size of remote file: 11 kB
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__/pair_watermark.png",
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[:,:,loc:-bbuf, loc:-bbuf] = watermark
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