INNER CODE UNIT · Python

mosaic_pixel

zhulinyv/Semi-Auto-NovelAI-to-Pixiv · src/batch_mosaic.py:62

def mosaic_pixel(img_path):
    img_path = str(img_path)
    box_list = detector(img_path)

    for box in box_list:
        with Image.open(img_path) as pil_img:
            neighbor = int(
                pil_img.width * env.neighbor if pil_img.width > pil_img.height else pil_img.height * env.neighbor
            )
            image = _mosaic_pixel(pil_img, (box[0], box[1], box[0] + box[2], box[1] + box[3]), neighbor)
            image.save(img_path)
            revert_img_info(None, img_path, pil_img.info)


# -------------------- #


def mosaic_lines(img_path):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…