I am unsure exactly about your white pixel filling criterion. However, I will offer a solution.
Create a histogram for each image and compare histograms. If for instance there are 800 red pixels in image A and 800 blue pixels in image B we can make an assumption that there exists a mapping from red to blue across images. There could be some mapping subtleties, for instance there could be 800 red and 800 yellow pixels in image A, then we would need to do a little work to determine which color maps to which color in image B, but that is a workable edge case.
Now (and this is assuming I understand your white filling problem) start with the image with the most white in its histogram and compare pixel for pixel both images. We do not need to compare the white pixels, because we already know there is not a 1:1 mapping between images. If all of the other pixels map correctly, then we know the image fits our idea of equality.