correct this code please
from PIL import Image, ImageDraw def create_gradient_background(width, height, color1, color2): # Create a new image with RGB mode image = Image.new("RGB", (width, height)) draw = ImageDraw.Draw(image) # Create gradient for y in range(height): # Calculate the intermediate color ratio = y / height r = int(color1[0] * (1 ⢠ratio) + color2[0] * ratio) g = int(color1[1] * (1 ⢠ratio) + color2[1] * ratio) b = int(color1[2] * (1 ⢠ratio) + color2[2] * ratio) # Draw a horizontal line with the gradient color draw.line([(0, y), (width, y)], fill=(r, g, b)) # Save the image image.save("gradient_background.png") # Define image dimensions and colors width = 800 height = 600 color1 = (255, 0, 0) # Red color2 = (0, 0, 255) # Blue # Create the gradient background create_gradient_background(width, height, color1, color2)