Jump to content

Clean Backdrops of mixed resolution and duplicates


Recommended Posts




Requires mediainfo and imagemagick command line utilities



I wanted to keep my backdrops clean of mixed resolution, non contiguous naming, and duplicate images,

The script uses imagemagick to yield a comparison value to identify duplicates.



Download mediainfo and imagemagick clis, Extract to folders of choice

Download CMD file above and copy to shell:sendto

edit CMD with paths to mediainfo and imagemagick and turn on/off log only



For each folder in path, re cursing subfolders)

If low res images exist AND 1+ high res then delete low res images

If duplicates exists delete duplicates

rename backdrops into order - backdrop.jpg, backdrop1.jpg, backdrop2.jpg, etc

creates a processed.txt in every processed folder, in case needs to be rerun...they can be easily deleted once happy



Test 1st before using on real folders 

Right click a folder eg. movie and send to the script, each separate folder is enumerated separately

The threshold value should be increased/decreased if duplicates are not being detected/uniques being detected as duplicates.

use imagemagick\compare -metric NCC backdrop1.jpg backdrop2.jpg null: manually from the command line to find a threshold value for comparison for use in your script



Backdrop order is not well respected, backdrop.jpg (the first one) shouldn't be deleted, unless it is a low res image amongst 1 or more high res images..Backdrop 11 will be ordered higher than Backdrop 2 due to batch order.

As with all my scripts its very crude, im guessing as i go along.

The Comparison function of image magic, could be improved upon, there may be quicker more appropriate functions and the use of a threshold could break out of comparison once its known to be different enough (for performance considerations)

Temporary files could be used to compare different resolution images, but that would take even longer and would require more understanding of imag magick comparison than i have.

if i could get the comparison value out of image magic without using a file, it would be more media browser change detection friendly.

have tried to use identity function to compute a quick hash to weed out 100% identity quickly, however the duplicates in practise are too nuanced for this function to yield match.

advice as always welcomed...

The NCC comparison can deal with different jpg quality factors, but cant detect identity where there is a slight offset between the two images, or if one image is a subimage of another (would be too computationally intensive, besides the script is looking for more identical ness that that..eg same image on fanart and tmdb..




fixed  crash when_result was not defined

Edited by ginjaninja
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...