How to fill these white pixels that are surrounded by these black pixels automatically?
Is there a way in photoshop where I can intelligently select the tiny white patches that are surrounded by black pixels to fill those white patches as black? The reason is I have a ton of images I need to process and there is no way I can sit down and do all these myself. Currently, there are 2 issues that I can see, a) the white patch size limit, if it's too big we would end up filling everything. b) there has to be a logic that says you can only fill the patches if they are surrounded by black pixels as well. I can write javascript myself but I don't know where to start...maybe there is an even easier way?

