Duplicate Image Finder (difPy)
Tired of going through all images in a folder and comparing them manually to check if they are duplicates?
The Duplicate Image Finder (difPy) Python package automates this task for you!
Read more on how the algorithm of difPy works in my Medium article Finding Duplicate Images with Python.
Check out the difPy package on PyPI.org
Description
DifPy searches for images in one or two different folders, 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 difPy delete them for you.
Basic Usage
Use the following function to make difPy search for duplicates in one specified folder:
from difPy import dif
search = dif("C:/Path/to/Folder/")
To search for duplicates within two folders:
from difPy import dif
search = dif("C:/Path/to/Folder_A/", "C:/Path/to/Folder_B/")
Folder paths must be specified as a Python string.
Output
DifPy gives two types of output that you may use depending on your use case:
A dictionary of duplicates/similar images that were found:
search.result
> Output:
{"image1" : {"location" : "C:/Path/to/Image/image1.jpg"},
"duplicates" : ["C:/Path/to/Image/duplicate_image1.jpg",
"C:/Path/to/Image/duplicate_image2.jpg"]},
...
}
A list of duplicates/similar images that have the lowest quality:
search.lower_quality
> Output:
["C:/Path/to/Image/duplicate_image1.jpg",
"C:/Path/to/Image/duplicate_image2.jpg", ...]
Additional Parameters
DifPy has the following optional parameters:
dif(directory_A, directory_B, similarity="normal", px_size=50,
sort_output=False, show_output=False, delete=False, silent_del=False)
similarity (str)
Depending on which use-case you want to apply difPy for, the granularity for the classification of the images can be adjusted.
DifPy 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.
sort_output (bool)
Per default, difPy will output the filenames of the duplicate images within a dictionary by the order in which they were found. If you want the duplicate images to be ordered alphabetically then set sort_output to true.
False= (default) output filenames of the duplicate/similar images by order they were found
True = outputs filesnames of duplicate/similar images in alphabetic order
show_output (bool)
Per default, difPy 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
delete (bool)
! Please use with care, as this cannot be undone
When set to True, the lower resolution duplicate images that were found by difPy are deleted from the folder. Asks for user confirmation before deleting the images. To skip the user confimation, set silent_del to True.
silent_del (bool)
! Please use with care, as this cannot be undone
When set to True, the user confirmation is skipped and the lower resolution duplicate images that were found by difPy are automatically deleted from the folder.
Metadata
Release files for difPy 2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| difPy-2.2.tar.gz | 7.3 kB | Without provenance | Details for difPy-2.2.tar.gz |
Release files / difPy-2.2.tar.gz
| Download URL | difPy-2.2.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c647a4b02df4ca6e08efd71ec179240dc57d5025cfbb7535007263bf5ecccc6d
|
|
BLAKE2b-256 checksum How to use checksums |
79ab812accfaf4e5a5e81388fd687a6f6f717db52b4c3a8c6b94699e57acbaa7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
|
Security for difPy 2.2
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.