Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Wagtail Images De-duplicator

wagtail-images-deduplicator is a Wagtail app to detect duplicate images in the admin. It's built with imagehash.

Requirements

Wagtail Images De-duplicator works with wagtail>=3.0.

Installation

Use pip to install this package:

pip install wagtail-images-deduplicator

Configuration

  • Add wagtail_images_deduplicator to your INSTALLED_APPS in your project's settings.

  • Add the DuplicateFindingMixin to your custom image model. An example of doing it is shown below:

from wagtail.images.models import Image, AbstractImage, AbstractRendition

from wagtail_images_deduplicator.models import DuplicateFindingMixin


class CustomImage(DuplicateFindingMixin, AbstractImage):
    admin_form_fields = Image.admin_form_fields


class CustomRendition(AbstractRendition):
    image = models.ForeignKey(
        CustomImage, on_delete=models.CASCADE, related_name="renditions"
    )

    class Meta:
        unique_together = (("image", "filter_spec", "focal_point_key"),)

If you choose to add the mixin and have existing image data, you will need to call save() on all existing instances to fill in the new hash value:

from wagtail.images import get_image_model

for image in get_image_model().objects.all():
    image.save()

Settings

WAGTAILIMAGESDEDUPLICATOR_HASH_FUNC

This setting determines the hash function to use.

Hash function Reference Setting name
Average hashing http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html average_hash
Perceptual hashing http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html phash (default)
Difference hashing http://www.hackerfactor.com/blog/index.php?/archives/529-Kind-of-Like-That.html dhash or dhash_vertical
Wavelet hashing https://fullstackml.com/2016/07/02/wavelet-image-hash-in-python/ whash
HSV color hashing colorhash
Crop-resistant hashing https://ieeexplore.ieee.org/document/6980335 crop_resistant_hash

WAGTAILIMAGESDEDUPLICATOR_MAX_DISTANCE_THRESOLD

This setting determines the maximum distance between 2 images to consider them as duplicates.
The default value is 5.

To help you assess how these different algorithms behave and to learn more about hash distances, check out the examples section of the imagehash library's README.

Release files for wagtail-images-deduplicator 1.0a1

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

Source distribution (sdist)

Source distribution for wagtail-images-deduplicator 1.0a1
File Size Uploaded
wagtail-images-deduplicator-1.0a1.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-images-deduplicator 1.0a1
File Interpreter ABI Platform
wagtail_images_deduplicator-1.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / wagtail-images-deduplicator-1.0a1.tar.gz

Download URL wagtail-images-deduplicator-1.0a1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1fc949c3b7e3ac4fc096fde44c3b0e541063108748e55e4df454f8ede5856db4
BLAKE2b-256 checksum
How to use checksums
0fee4189203b649062a884c7670b79564810e8f76f4b9470cfa2ee0b5e58a6dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.2

Release files / wagtail_images_deduplicator-1.0a1-py3-none-any.whl

Download URL wagtail_images_deduplicator-1.0a1-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa6d0115eb2f911be45f9a0e33435f1b688c5718767a1741be8ca5a9a3bd2b8d
BLAKE2b-256 checksum
How to use checksums
cd2afa16a831676c80d9fb6a4ea88366b98138c676193d01417e625c4615209f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.2

Release history Release notifications | RSS feed

This release

1.0a1 This release

2 release files

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