Skip to main content

Collection of image tools for checking photos for blur and duplicates, and handle fake PNG transparency

Project description

imgtoolkit

A powerful Python toolkit for image processing, specializing in finding duplicate and blurry images. This tool helps you organize your image collections by identifying and managing duplicate images and detecting low-quality or blurry photos.

Features

  • Find Duplicate Images: Uses perceptual hashing (dhash) to identify visually identical images
  • Detect Blurry Images: Identifies and separates blurry or low-quality images
  • Remove Fake PNG Backgrounds: Converts fake transparent PNG images to true transparent PNGs
  • Multi-format Support: Works with various image formats (JPG, JPEG, PNG, BMP, TIFF)
  • Configurable: Supports JSON configuration files for customized settings
  • Parallel Processing: Uses multiprocessing for improved performance
  • Progress Tracking: Shows progress bars for long-running operations

Installation

pip install imgtoolkit

Upgrade to the Latest Version

pip install --upgrade imgtoolkit

Usage

Command Line Interface

# Show help
imgtoolkit --help

# Find duplicate images
imgtoolkit find-duplicates [--folder OUTPUT_FOLDER] [--prefix PREFIX] [--formats jpg png]

# Find blurry images
imgtoolkit find-blur [--folder OUTPUT_FOLDER] [--threshold BLUR_THRESHOLD] [--formats jpg png]

# Remove duplicate prefix from images
imgtoolkit remove-duplicate-prefix FOLDER [--prefix PREFIX]

# Remove fake transparent background from PNG
imgtoolkit remove-fakepng-bg SOURCE_PNG DESTINATION_PNG

# Show version
imgtoolkit version

Using Configuration File

Create a JSON configuration file (e.g., config.json):

{
    "duplicate": {
        "folder": "duplicates/",
        "prefix": "DUP_",
        "formats": ["jpg", "png"]
    },
    "blur": {
        "folder": "blurry/",
        "threshold": 25,
        "formats": ["jpg", "png"]
    }
}

Then run with the config file:

imgtoolkit --config config.json find-duplicates
imgtoolkit --config config.json find-blur

Command Options

find-duplicates

  • --folder: Output folder for duplicate images (default: "duplicate/")
  • --prefix: Prefix for marking duplicate files (default: "DUPLICATED_")
  • --formats: List of image formats to process (default: jpg, jpeg, png)

find-blur

  • --folder: Output folder for blurry images (default: "blur/")
  • --threshold: Blur detection threshold (default: 20, lower = more blurry)
  • --formats: List of image formats to process (default: jpg, jpeg, png)

remove-duplicate-prefix

  • folder: The folder containing marked duplicate images
  • --prefix: Prefix to remove from filenames (default: "DUPLICATED_")

remove-fakepng-bg

  • src: Source PNG file with fake transparent background
  • dst: Destination path for the fixed PNG file

Supported Image Formats

  • JPEG (.jpg, .jpeg)
  • PNG (.png)
  • BMP (.bmp)
  • TIFF (.tiff)

Requirements

  • Python 3.6+
  • OpenCV (cv2)
  • Pillow
  • dhash
  • numpy
  • alive-progress

Error Handling

The toolkit provides clear error messages for common issues:

  • Invalid image formats
  • Missing or inaccessible files
  • Processing errors
  • Invalid configuration

Development

To contribute to imgtoolkit:

  1. Clone the repository
  2. Install development dependencies:
pip install -e ".[dev]"
  1. Run tests:
pytest

Version History

v0.1.3 Resolved a bug of handling incomplete / corrupted image files

v0.1.2 Revamp the command structure, adding features of remove fake PNG backgrounds

License

MIT License - See LICENSE file for details.

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

imgtoolkit-0.1.6.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imgtoolkit-0.1.6-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file imgtoolkit-0.1.6.tar.gz.

File metadata

  • Download URL: imgtoolkit-0.1.6.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.3 cpython/3.13.5 HTTPX/0.28.1

File hashes

Hashes for imgtoolkit-0.1.6.tar.gz
Algorithm Hash digest
SHA256 15c0e12b3b31225dec6e7a832abefea46d8881160e44c1e46c77cea229a6c80a
MD5 f83f4f766540eb99539b29650a8ca98f
BLAKE2b-256 795b65f877ce9ec7423afe71a2a5a7ea26789c5f56bf1b5ca107210a73bf8ab4

See more details on using hashes here.

File details

Details for the file imgtoolkit-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: imgtoolkit-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.3 cpython/3.13.5 HTTPX/0.28.1

File hashes

Hashes for imgtoolkit-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3bf142f5f715e17b98eb00e39eb1010ee1a77cae104f1e90db7b583b80753d57
MD5 07605f16b5277b32bef572650884376e
BLAKE2b-256 5198e499e0796e99f44dcc7cc83937d7761e155e68401821334b24fe74146379

See more details on using hashes here.

Supported by

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