Clicked too many similar photos? Have saved the same photo in different folders? I know that feel.
You click photos on camera, send it through WhatsApp. Now you back up the images and you have two copies of the photos from the gallery and WhatsApp. It is annoying, cluttered and takes extra space unnecessarily.
I came across this issue while going through my father-in-law’s photo collection. Here’s what I did to find the duplicate photos and remove them.
Find and remove duplicate photos with digiKam
digiKam is a free and open source utility for managing photo collections. It is primarily aimed at photographers but you do not need to be a professional camera person for using it.
Let me show you how you can use this tool for finding duplicate photos and if you feel like it, remove the duplicate ones.
First thing first, install digiKam. It is a popular application and you should be able to install it from the software center or using the package manager of your distribution.
When you start digiKam for the first time, it asks for the location of your image collection. Then it creates a SQLite database and then imports the images.
Now that you have imported your photos, go to Tools->Find Duplicates from the file menu.
It will take some time depending on the number of images you have in your collection. After that, you should see all the photos that have duplicate images in the left sidebar. It also shows the duplicate photos for the selected image in the right sidebar.
In the screenshot above, there are four copies of the same photo that I have selected in the left sidebar. You can see one of the images is labelled as ‘Reference image’. But it is up to you to believe which is original and which is duplicate.
By default, the duplicate photos are divided into sections based on their location, i.e. folders. You may change that by going to View->Separate Items in the file menu.
To delete the duplicate photos, select the image(s) in the right sidebar and then hit the delete button.
You can repeat this by selecting the image in the left sidebar and then delete the duplicates one by one. Too time taking? There is a trick to delete multiple duplicates at a time.
Deleting multiple duplicates images in digiKam
If you want to delete duplicate photos for more than images at the same time, select all the images from the left sidebar.
Now, go to the file menu -> View -> Sort Items and select By Similarity.
This will put all the referenced images at the bottom. You can select all the images in the right sidebar that are NOT labelled as duplicate and press the delete button.
Bonus Tip: There is a trash bin for restoring deleted photos
Accident happens. It is common to accidentally delete the wrong photos. This is why images are never really deleted by digiKam immediately. Instead, it creates a hidden .dtrash folder in the same folder where your photos are stored and moves the ‘deleted’ photos here.
Even on the application interface, you can see the Trash folder. You can find your ‘deleted’ photos here and restore the ones you want.
I hope you like this quick tutorial on finding and removing duplicate images in Linux. On a similar note, you may want to know about using GUI tools for finding duplicate files in your Linux system.
Have questions or suggestions? Please leave a comment below.