Dec-26-2021, 09:16 PM
I got pretty close. Perhaps you can tweek it a little further.
from PIL import Image import numpy as np img = Image.open('color_field.jpg') width = img.size[0] height = img.size[1] for i in range(0,width):# process all pixels for j in range(0,height): data = img.getpixel((i,j)) if data[0] < 235 : img.putpixel((i,j),(255, 255, 255)) else : img.putpixel((i,j),(0, 0, 0)) img.show()