Thank you to Bobuk for the original script and algorythm. This script has been modified to allow running from command line with arguments and to allow comparing pictures from one directory with pictures in another directory. The main reason for that was that I had to compare b/w photos in one dir with the color originals in another dir to find out which originals were missing.
The original script can be found here.