Jump to content
LaunchBox Community Forums

Tool to remove duplicate images


MTyrealhanla
 Share

Recommended Posts

Hi, I am relatively new to the launchbox community.  I absolutely love the application.  Upon importing my games and downloading metadata from both the launchbox games database and emumovies i noticed that sometimes games would get duplicate box art.  These duplicates had the exact same file name, the only different were the extensions (ie. jpg, png).  I wrote a very quick and dirty application that will find these duplicates and delete one based on the extension you provide.  I made it as safe as possible, so it only finds images with the EXACT same file name, the only difference is the extension.

When you launch the console app, you just give it the path of your images directory, and then the extension you would like to delete then hit enter.  The app will recursively drill to every folder and perform the deletion.

I put the code on GitHub here: https://github.com/mtyrealhanla/DupPicDeleter

Use at your own risk obviously, make a backup just in case but it worked beautifully in my case.

dupExample.png

appExample.png

Link to comment
Share on other sites

2 hours ago, Norfair said:

I've found a solution for deleting duplicate images (by comparing checksums). Check out my post here:

 

very cool @Norfair.  Thanks, ill check that out.  I will probably continue down this path also because I want to make it pretty launchbox specific (like how this app will delete images with same name minus extension also, whether or not the checksums match).  I also found that sometimes launchbox will have duplicate images, where one of the images is tied to the correct game and one isn't (see image).  I'm can't think of a way to ensure an image is actually tied to the correct game, so i may do the checksum enhancement and have it spit out results so the users can check by hand (maybe unless the duplicate image has "ALMOST" the same name... Game-01, Game-02, etc.).

2017-01-29 09_56_05-Banner.png

Link to comment
Share on other sites

8 minutes ago, MTyrealhanla said:

very cool @Norfair.  Thanks, ill check that out.  I will probably continue down this path also because I want to make it pretty launchbox specific (like how this app will delete images with same name minus extension also, whether or not the checksums match).  I also found that sometimes launchbox will have duplicate images, where one of the images is tied to the correct game and one isn't (see image).  I'm can't think of a way to ensure an image is actually tied to the correct game, so i may do the checksum enhancement and have it spit out results so the users can check by hand (maybe unless the duplicate image has "ALMOST" the same name... Game-01, Game-02, etc.).

2017-01-29 09_56_05-Banner.png

One problem with my method is when an image is used for multiple games. As @DOS76 said in the other thread, fanart images can be used for multiple games (maybe other image categories too). A Launchbox specific tool could handle this situation.

Link to comment
Share on other sites

The main thing is that per platform / per game / per image category (say screenshot...) there are no dup images so if it searches as the structure is then it would only delete a dup in that category. I'm no coder so I don't even know if that is possible or if that would stop the images being used for multiple games, I didn't even know they were used on multiple games :)

Link to comment
Share on other sites

Yeah i think once launchbox decides to attach an incorrect image to a game, then it becomes a very difficult problem.  One i probably wouldn't want to take any assumptions on.  What i can do is make it output those duplicates to the user so you can make a decision.  I did have a little time while the kid was napping so i slapped a GUI on the existing version and uploaded it to the downloads section.  I also added a test mode so you can see what the app would delete before actually doing it.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...