my idea explained:
You have image A and B of 3 x 1 pixels
Let's say the colors are
RGB GBR
You loop through the image and "dump" the color var in a string and appends the next to it, you may even want to seperate the colors by a comma for example.
When the 2 vars are made
You will have 2 strings. Compare them