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

Function crop_image

utils/marker.py:84–92  ·  view source on GitHub ↗

裁剪图片边缘空白

(im)

Source from the content-addressed store, hash-verified

82
83
84def crop_image(im):
85 """裁剪图片边缘空白"""
86 bg = Image.new(mode='RGBA', size=im.size)
87 diff = ImageChops.difference(im, bg)
88 del bg
89 bbox = diff.getbbox()
90 if bbox:
91 return im.crop(bbox)
92 return im
93
94
95def gen_mark(args):

Callers 1

gen_markFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected