User-2052324419 posted
I think we'd need to know more about what you're actually checking for? A database would probably give you better performance with perhaps a set of tables such as:
a) Basic image data (name, type, uniqueid)
b) Colour data - a list of all detected colours (RGB or hex) in every image
c) A link table between which images have which colours (and maybe x and y pixel position(s) if required)
Without knowing what you're checking for, it's difficult to say whether this would solve your problem, but scanning each pixel of an image each time is going to be CPU/RAM intensive for sure.