You can try running MD5 on the actual bitmap data instead of a JPEG file. I tested on my machine (also a quad-core Xeon processor), and the next one works in about 900 ms on a 23 megapixel image.
uint32_t width = MagickGetImageWidth(imageWand);
uint32_t height = MagickGetImageHeight(imageWand);
uint8_t *imageData = malloc(width * height * 3);
MagickExportImagePixels(imageWand,
0, 0, width, height, "RGB", CharPixel, imageData);
unsigned char *imageDigest = MD5(imageData, width * height * 3, NULL);
free(imageData);
source
share