Untitled

 avatar
unknown
plain_text
a year ago
550 B
9
Indexable
from PIL import Image, ImageDraw

# Open the uploaded image
img_path = "/mnt/data/437BFD78-4FE7-44BE-A8CF-F7EB1A39B72A.jpeg"
img = Image.open(img_path)

# Create a drawing object
draw = ImageDraw.Draw(img)

# Get image dimensions
width, height = img.size

# Draw vertical grid lines
for x in range(0, width, 50):  # Adjust step size depending on block size
    draw.line((x, 0, x, height), fill="red", width=2)

# Draw horizontal grid lines
for y in range(0, height, 50):
    draw.line((0, y, width, y), fill="red", width=2)

# Show result
img.show()
Editor is loading...
Leave a Comment