Jump to content


Photo

Clean Backdrops of mixed resolution and duplicates

backdrop tool utility script duplicate

  • Please log in to reply
No replies to this topic

#1 ginjaninja OFFLINE  

ginjaninja

    Advanced Member

  • Members
  • 1641 posts
  • Local time: 12:52 AM
  • Locationuk

Posted 06 March 2015 - 09:03 AM

https://dl.dropboxus...erBackdrops.cmd

 

Requires mediainfo and imagemagick command line utilities

 

Background

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.

 

Install

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

 

Functions

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

 

Usage

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

 

Notes

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..

 

 

edit

fixed  crash when_result was not defined


Edited by ginjaninja, 06 March 2015 - 04:23 PM.






Also tagged with one or more of these keywords: backdrop, tool, utility, script, duplicate

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users