MCPcopy Create free account
hub / github.com/Royalvice/DocDiff / add_mark

Function add_mark

utils/marker.py:48–69  ·  view source on GitHub ↗

添加水印,然后保存图片

(imagePath, mark, args)

Source from the content-addressed store, hash-verified

46
47
48def add_mark(imagePath, mark, args):
49 """
50 添加水印,然后保存图片
51 """
52 im = Image.open(imagePath)
53 im = ImageOps.exif_transpose(im)
54
55 image, mask = mark(im)
56 name = os.path.basename(imagePath)
57 if image:
58 if not os.path.exists(args.out):
59 os.mkdir(args.out)
60
61 new_name = os.path.join(args.out, name)
62 if os.path.splitext(new_name)[1] != '.png':
63 image = image.convert('RGB')
64 image.save(new_name, quality=args.quality)
65 #mask.save(os.path.join(args.out, os.path.basename(os.path.splitext(new_name)[0]) + '.png'),
66 # quality=args.quality)
67 print(name + " Success.")
68 else:
69 print(name + " Failed.")
70
71
72def set_opacity(im, opacity):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected