INNER CODE UNIT · Python
_mosaic_blurry
zhulinyv/Semi-Auto-NovelAI-to-Pixiv · src/batch_mosaic.py:21
def _mosaic_blurry(img, fx, fy, tx, ty):
length = img.width if img.width > img.height else img.height
c = img.crop((fx, fy, tx, ty))
c = __mosaic_blurry(c, length)
img.paste(c, (fx, fy, tx, ty))
return img
def mosaic_blurry(img):
img = str(img)
with Image.open(img) as image:
box_list = detector(img)
for box in box_list:
image = _mosaic_blurry(
image,
box[0],
box[1],
box[0] + box[2],