# Create a 400x400 PPM image filled with red color width = 400 height = 400 max_color = 255 with open("red_image.ppm", "w") as f: f.write(f"P3\n{width} {height}\n{max_color}\n") for i in range(height): for j in range(width): f.write(f"{max_color} 0 0 ") # Red color f.write("\n")