Skip to main content

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.

Metadata

Release files for difPy 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for difPy 1.0.1
File Size Uploaded Provenance Actions
difPy-1.0.1.tar.gz 5.8 kB Without provenance Details for difPy-1.0.1.tar.gz

Release files / difPy-1.0.1.tar.gz

Download URL difPy-1.0.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
daa2bfc261065436f041066be0458976d5669693576ac0902e91365540785ce9
BLAKE2b-256 checksum
How to use checksums
a6cf39ed4e4c766169aac47956b553f67d99601fb118d2f218c80b097a77184c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.6.1 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Security for difPy 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page