INNER CODE UNIT · Python

mosaic_lines

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

def mosaic_lines(img_path):
    img_path = str(img_path)
    box_list = detector(img_path)
    with Image.open(img_path) as image:
        draw = ImageDraw.Draw(image)
        for box in box_list:
            x, y, w, h = box

            while y <= box[1] + box[3]:
                xy = [(x, y), (x + w, y)]
                draw.line(
                    xy,
                    fill="black",
                    width=int(10 * 0.35),
                )
                y += int(box[3] * 0.15)
        image.save(img_path)
        revert_img_info(None, img_path, image.info)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…