from PIL import Image, ImageDraw import random
WHITE = (255, 255, 255) BROWN = (139, 69, 19) # soil color GREY = (128, 128, 128) # water color RED = (255, 0, 0) # Superfund site color
background_image = Image.open('love_canal_neighborhood.png') # replace with your own image file path
new_size = (int(1920 * background_image.width / background_image.height), 1080) resized_background_image = background_image.resize(new_size)
canvas = Image.new('RGB', (1920, 1080)) canvas.paste(resized_background_image)
def draw_buildings(draw): # Hardcoded building locations for demonstration purposes building_coords = [(100, 150), (300, 200), (500, 250), (700, 300), (900, 350)] for coord in building_coords: x1, y1 = coord width, height = 50, 100 draw.rectangle([(x1, y1 - height // 2), (x1 + width, y1 + height // 2)], fill=BROWN)
def draw_superfund_sites(draw): # Hardcoded Superfund site locations for demonstration purposes superfund_coords = [(200, 300), (600, 400), (1000, 500)] for coord in superfund_coords: x1, y1 = coord width, height = 20, 10 draw.rectangle([(x1, y1 - height // 2), (x1 + width, y1 + height // 2)], fill=RED)
def draw_streets(draw): # Hardcoded street locations for demonstration purposes street_coords = [(0, 100), (1920, 100), (500, 800), (1200, 600)] for coord in street_coords: x1, y1 = coord width, height = 50, 10 draw.rectangle([(x1, y1 - height // 2), (x1 + width, y1 + height // 2)], fill=BROWN)
def draw_rivers_and_lakes(draw): # Hardcoded river/lake locations for demonstration purposes river_coords = [(400, 200), (800, 500)] lake_coords = [(1200, 300), (1400, 600)] for coord in river_coords: x1, y1 = coord width, height = 10, 100 draw.rectangle([(x1 - width // 2, y1 - height // 2), (x1 + width // 2, y1 + height // 2)], fill=GREY) for coord in lake_coords: x1, y1 = coord width, height = 10, 50 draw.rectangle([(x1 - width // 2, y1 - height // 2), (x1 + width // 2, y1 + height // 2)], fill=GREY)
draw = ImageDraw.Draw(canvas) draw_buildings(draw) draw_superfund_sites(draw) draw_streets(draw) draw_rivers_and_lakes(draw)
canvas.save('love_canal_neighborhood.png')