└── Green /Green: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | 3 | # Open an image file 4 | image_path = "path/to/your/image.jpg" 5 | img = Image.open(image_path) 6 | 7 | # Convert white color to green 8 | data = img.getdata() 9 | new_data = [(0, 255, 0) if pixel == (255, 255, 255) else pixel for pixel in data] 10 | 11 | # Update the image with the modified colors 12 | img.putdata(new_data) 13 | img.save("path/to/save/new/image.jpg") 14 | 34 15 | --------------------------------------------------------------------------------