I have a large package of .jpg images of the sky, some of which are artificially white; these images are set to (255, 255, 255) for every pixel. I need to pick these images out. I do so by only looking at the first 5 pixels. my code is :
im = Image.open(imagepath)
imList = list(im.getdata())[:5]
if imList = [(255, 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255)]:
return True
However, this process takes a large amount of time because im.getdata() returns the whole image, is there a different function I can use to return less data, or perhaps specific pixels? I need to look at multiple pixels because other images may have one or two pixels that are completely white, so I look at 5 pixels in order to not get false positives.