Skip to main content

Python Duplicate Image Finder - searches for duplicate image files within a specified folder path.

Project description

Duplicate Image Finder (DIF)

Tired of going through all images in a folder and comparing them manually to check if they are duplicates?

-> The Duplicate Image Finder (DIF) for Python automates this task for you!


Description

The DIF searches for images in a specified target folder, compares the images it found and checks whether these are duplicates. It then outputs the image files classified as duplicates and the filenames of the duplicate images having the lower resolution, so you know which of the duplicate images are safe to be deleted. You can then either delete them manually, or let the DIF delete them for you.

You can read more on how the algorithm of the DIF works in my Medium article Finding Duplicate Images with Python.

Basic Usage

Use the following function to make DIF search for duplicates in a folder:

from difPy import dif

dif.compare_images("C:/Path/to/Folder/")

The folder path must be specified as a Python string.

Output: a Python set of the filenames of the duplicate images with lower resolution.

Additional Parameters

The compare_images function has the following optional parameters:

compare_images(directory, show_imgs=True, similarity="normal", px_size=50, delete=False)

show_imgs (bool)

Per default, the DIF will output only the filename of the duplicate images it found. If you want the duplicate images to be shown in the console output, change this value to True.

False= (default) outputs filename of the duplicate/similar images found

True = outputs a sample and the filename

similarity (str)

Depending on which use-case you want to apply DIF for, the granularity for the classification of the images can be adjusted.

The DIF can f. e. search for exact matching duplicate images, or images that look similar, but are not necessarily duplicates.

"normal" = (recommended, default) searches for duplicates (with a certain tolerance)

"high" = searches for duplicate images with extreme precision, f. e. for use with images that contain a lot of text

"low" = searches for similar images

px_size (int)

! Recommended not to change default value

Absolute size in pixels (width x height) of the images before being compared. The higher the px_size, the more computational ressources and time required.

delete (bool)

! Please use with care, as this cannot be undone !

When set to True, the lower resolution duplicate images that were found by the DIF are automatically deleted from the folder.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

difPy-1.2.tar.gz (5.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page