I’m looking for a tool/software that will take an image as an example and scan my hard drive to find similar images to it, just like what Google Images does on the Web.

Must run on Linux. See Find visually similar images for a given image file (on Windows) for Windows software.


7 Answers 7


findimagedupes is the usual command-line program for that on Linux and other Unix platforms.

It looks for similarity among all files. You can filter the output to retain only information about one file if you wish, I don't think that makes a huge difference in performance (the slow part is scanning all files).

To scan PNG and JPEG files under a certain directory, and only retain images similar to SOMEIMAGE.jpg, run the following commands:

cd /path/to/directory
find . \( -name '*.jpg' -o -name '*.png' \) -print0 |
findimagedupes -0 - |
grep -F 'SOMEIMAGE.jpg'

If you're going to do that often, findimagedupes can store image fingerprints in a database, which makes searches a lot faster once the database is built. See the manual for more details.

  • the result is: "bash: findimagesdupes: command not found". in the website it says that most linux distributions have the packages installed by default and i checked kal linux (which is updated) and it has the "imagemagik" installed. do i need to install any other package?
    – user6306
    Commented Mar 24, 2015 at 5:15
  • 4
    @Saeed You need to install the findimagedupes package. Most distributions, including Kali, have it prepackaged, not preinstalled. Commented Mar 24, 2015 at 8:55
  • Yes you were right, now i run the command and it appears that it's working but i neither get any output nor error.
    – user6306
    Commented Mar 24, 2015 at 12:43
  • findimagedupes works for me like a charm, here is its documentation: manpages.ubuntu.com/manpages/precise/man1/…
    – pts
    Commented Nov 30, 2016 at 13:52
  • I don't remember when I added it, but the -a option lets you just check your database for hits against a short list of files, which will be quicker than checking them all - something like O(m*n) for m new files and n in the database, instead of O(n^2).
    – jhnc
    Commented Feb 2, 2019 at 20:47

I recommend geeqie, you can install via package manager such as sudo apt install geeqie.

enter image description here

As you can see, it able to group by Pikachu's ears even though the images quite different. Note that this directory has ~3759 images and take ~5 minutes to complete.

How to use:

  1. cd to desired directory. Alternatively you can open geeqie first and insert the path later.
  2. type geeqie to open current directory images.
  3. ctrl+A to highlight all images in left panel.
  4. right-click to open context menu.
  5. Select "Find duplicates.." menu item
  6. Select "low" similarity. Wait for bottom right progress bar complete. You may need re-select "custom" similarity if you type in Custom Threshold field but not refresh the page.
  7. Click "Thumbnails" button to view thumbnails(re-click if not showing)
  8. Right-click individual item and select "View" in main window OR "View in new window".
  9. Only similar images groups will visible, the rest will remains hidden.
  10. You can then tick "Compare two file sets" checkbox on bottom right, drag&drop image file(s) you want to compare from file manager into right panel, it will shows the similar images (from first set) on left panel. The bug is similarity level seems not working well here and only able to shows exactly same instead of low similarity.


I just wrote a python script (Not related to geeqie) to do this. This script has robust options to let you choose hash method or Manhattan norm method, saved matched/not-match output as symbolic link to specific directory, caching file(You can compare 10000+ images in seconds !), and specify acceptable percentage. Currently I only make it works in Linux.

  • Is this script related to Geeqie? Is it a plugin, for instance? If it is not, please edit your post. Thanks
    – knb
    Commented Aug 26, 2019 at 7:44
  • @knb Not related to Geeqie. Edited.
    – 林果皞
    Commented Aug 26, 2019 at 8:01
  • geeqie is quite good. If only the Move to dialog box took me to the right working directory I'd find this useful. Commented Mar 14, 2021 at 0:36
  • 1
    @Fruit your script also works on macOS, I just tested it :)
    – Heisenbug
    Commented May 4, 2021 at 9:53

A little DIY but you can do this sort of thing with python plus either OpenCV or Numpy - in either case the approach is the same:

  • Generate a finger print of the image that you are searching for by something along the lines of:
    • Reduce to grayscale
    • resize to a fixed size, e.g. 64x64
    • possibly generate a histogram of the intensities
  • Use os.walk to find files to test
  • generate the finger print of the possible match
  • compare the finger print e.g. xor the finger prints together and count the 1s for a measure of how different they are.
  • Add a GUI if you desire.

    1. Any OS including Windows, Linux, OS-X, Raspberry Pi, Supercomputers.
    2. Free - both price and FOSS
    3. GUI - Lots of GUI libraries available
    4. Lots of examples online just Google.
    5. A learning experience - you may count this as a plus or minus.
  • 6
    Thanks but that's A lot of DIY and i don't have the time to learn another programming language, it'd be good if there was a program to do that automatically.
    – user6306
    Commented Feb 24, 2015 at 19:44
  • @Conspiria If you are fluent in a particular programming language that would be relevant. There are similar libraries for other languages.
    – Eric S
    Commented Jan 22, 2019 at 1:37

NOTE: This does not work anymore. I couldn't get it to run for most files anymore, it seems like this tool is broken.

There is Libpuzzle, that will do the comparison part, but not the search for all images part. To install it use the package libpuzzle-bin, that will give you the command line tool.

It is a library and a command line tool that is designed for the purpose of comparing two images and listing their similarity. I used it to find files that were very similar (logos) a while ago, that worked well.

If you want to use it, you must use additional software that calls libpuzzle with the appropriate options.

I wrote a script that can be used for a find -exec command. The script goes like this (I have it in a file called simple-pd.sh):

if (( $(echo "0.80<`puzzle-diff \"$1\" \"$2\"`" | bc -l) )) ; then
   exit 0
exit 1

it is invoked like this:

find . -regex ".*jpg\|.*gif\|.*png" -exec ./simple-pd.sh MYIMAGE {} \; -print

where you replace MYIMAGE with the image you want to have the comparison on. The script needs executable rights (chmod +x simple-pd.sh)

The tool (together with the scripts here) will do what you want most of the time.

While I do like the tool it has its downsides. It can't read all files (I had problems with jpgs sometimes) and is irritating when it fails.

The parameters for puzzle-diff are hardly documented, you will need to test on some images that you want to have and some that you don't to see which ones are the best for your task.

My Script assumes that an image that is very similar (0.80) is to be reported as YES and the rest as NO. You might want to reduce that number to fit your needs.

  • okay so i installed libpuzzle-php on Kali and put your script on a sh file in my root and typed in the command to invoke it but i only get " find: `./puzzle.sh': Permission denied "
    – user6306
    Commented Feb 25, 2015 at 12:08
  • 1
    did you chmod +x puzzle.sh? Commented Feb 25, 2015 at 12:09
  • 1
    @Saeed No, it should not. Could you email me the file (or its location)? Then I'll have a look tonight. Commented Feb 25, 2015 at 12:27
  • 1
    Okay I've just sent them to the Email address you put in your profile. thanks
    – user6306
    Commented Feb 25, 2015 at 12:35
  • 1
    @Saeed: I could not get it to run anymore and I didn't find the bug in libpuzzle that causes this. I'm now abandoning this. Commented Mar 20, 2015 at 15:31

dupeGuru PE. Plus it's open-source. :)

dupeGuru Picture Edition (PE for short) is a tool to find duplicate pictures on your computer. dupeGuru PE is a big brother of dupeGuru. It works like dupeGuru, but is specialized for duplicate pictures matching. dupeGuru PE runs on Windows, Mac OS X and Linux.

dupeGuru PE is efficient. Not only can dupeGuru PE find exact matches, but it can also find duplicates among pictures of different kind (PNG, JPG, GIF etc..) and quality. On Mac OS X, dupeGuru PE can scan your iPhoto library.

dupeGuru PE is customizable. You can tweak its matching engine to find exactly the kind of duplicates you want to find. The Preference page of the help file lists all the scanning engine settings you can change.

dupeGuru PE is safe. Its engine has been especially designed with safety in mind. Its reference directory system as well as its grouping system prevent you from deleting pictures you didn't mean to delete.

Compare any picture format. dupeGuru PE supports JPG, PNG, TIFF, GIF and BMP formats. All these formats can be compared together. The Mac OS X version of dupeGuru PE also supports PSD and RAW (CR2 and NEF) formats.

Your iPhoto and Aperture libraries are supported.

Do whatever you want with your duplicates. Not only can you delete duplicates files dupeGuru finds, but you can also move or copy them elsewhere. There are also multiple ways to filter and sort your results to easily weed out false duplicates (for low threshold scans).

(answer is copied from https://superuser.com/questions/311633/free-visual-similarity-image-for-a-local-hard-drive-search/453251#453251 - all credit to Pat on SuperUser)


Try search by image on disk. It is browser-based (Linux, Windows, Mac etc.) program I developed. Works best with Chrome and Firefox, as other browsers might not support folder selection. You can use the program offline by downloading the web-page and hosting it at port 8080, because it does not involve server-processing of the images.

  • Please state explicitly whether it works on Linux (since each question is supposed to be unique, each answer must be different, addressing the question's unique requirements). Please also apply the same advice as on the other page. Thanks!
    – Nicolas Raoul
    Commented Jan 22, 2019 at 0:59

I haven't seen anyone mention Digikam, surprisingly: https://digikam.org/

It's really more of an entire photo manager, but finding similar images is one of the functionalities it offers, but there's no CLI, only GUI.

You simply "import" the folder you wish to scan for duplicates in, then choose "Find Duplicates" from the Tools menu.

Your Answer

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