Coder Social home page Coder Social logo

crackercat / duplicate-image-finder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from elisemercury/duplicate-image-finder

0.0 0.0 0.0 156 KB

difPy - Python package for finding duplicate images within a folder.

License: MIT License

Python 100.00%

duplicate-image-finder's Introduction

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!

pip install difPy

๐Ÿ‘‰ difPy v2.0 has some major updates and new features. Check out the release notes for a detailed listing.

Read more on how the algorithm of difPy works in my Medium article Finding Duplicate Images with Python (applies to v1.0)

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)

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 automatically deleted from the folder.

duplicate-image-finder's People

Contributors

elisemercury avatar ppizarror avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.