Spaces:
Sleeping
Sleeping
File size: 729 Bytes
acd1e58 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
from PIL import Image
def tile_image(image, tile_size, overlap):
"""
A function to break an image into tiles
Args:
image: The image to break into tiles
tile_size: The size of the tiles
overlap: The overlap between tiles
Returns:
A list of tiles
"""
# Get the image size
width, height = image.size
# Create a list to store the tiles
tiles = []
# Loop through the image and break it into tiles
for x in range(0, width, tile_size - overlap):
for y in range(0, height, tile_size - overlap):
# Get the tile
tile = image.crop((x, y, x + tile_size, y + tile_size))
tiles.append(tile)
return tiles |