I am doing hard drive recovery for a friend and the drive is full of thumbnails & crops from face recognition in addition to original images. Is there a software tool (and preferably freeware) that can detect derivative images and assist you to perform batch deletion?

I have seen many duplicate image programs of varying quality and personally only save the original image & final edit and use CRC to detect duplicates. However, in this case it would be really helpful to find a tool that can detect downsized and cropped images as "sub duplicates" of an image, only keeping the most complete and highest quality image.

  • \$\begingroup\$ In my opinion, let a program to delete the photos of a friend... it is a bad idea. \$\endgroup\$
    – Rafael
    Commented Dec 29, 2015 at 21:17

2 Answers 2


Without a person doing a visual presorting or prebinning of similar files together to start with, what you are asking for is an incredibly computationally intensive process.

If you are not adverse to some programming (even scripting programming, such as Python), take a look at ImageMagick command-line tools, especially the ImageMagick compare command. It has a -subimage-search option to determine if one image is contained within another. Note that for subimage-search, the subimage must be the same size in the large image; they cannot differ by scaling.

So subimage-search will help with determining if one photo is a crop from another photo, as long as the crop was not also resized.

Now, if the photos are of the same scene, but just resized, in order to compare them with ImageMagick, you'd have to use the convert command to make them the same size, then use the compare command to determine their relative difference (there are many different metric type options for the compare command.

Why is this computationally intensive?

Assume you have n photos you want to check for comparison. So the first photo is compared with n-1 remaining photos, the second photo is compared with n-2 remaining photos (besides itself and the first photo, which has already been compared), on up to the n-1th photo being compared to the nth photo. This is a partial sum of the first n natural numbers, which comes out to (n² - n)/2 comparisons.

There are image processing algorithms that can do both scaling and subimage finding in the same process. These algorithms typically rely on frequency-domain or wavelet-domain compression techniques to identify similar regions in images. But these algorithms are also computationally intensive, roughly proportional in complexity (time) to the square of the size of the files being compared (i.e., αk² seconds/KiB, where k is in kilobytes, and α is some proportionality constant for your algorithm and computer system).

But since there are Ω(n²) (a computer science notation called "Big-O notation", meaning "on the order of", or "roughly") comparisons each being quadratic in time, you have an algorithm that is, in computer terms, of "Ω(n²)×Ω(s²)" complexity. That means, this can take a long while, and is very sensitive to increases in the number of files to compare and the average file size.


I'm not sure this is exactly what you're looking for, but you should be able to do a Windows search based on dimensions. Search for files smaller than the original images and then you should be able to remove them.

That, of course, is assuming that you don't want to save any smaller files.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.