elisemercury / Duplicate-Image-Finder

difPy - Python package for finding duplicate or similar images within folders
https://difpy.readthedocs.io
MIT License
448 stars 67 forks source link

All my images are considered invalid #63

Closed Halogenes closed 1 year ago

Halogenes commented 1 year ago

I try to compare 133 .png pictures but they are all considered invalid by the script.

I don't understand where this can come from because the script was working with these same pictures before I downloaded the latest version (today).

Moreover I can open them with Windows.

Thanks for your work anyway!

search = difPy.dif(r"D:\Fichiers conservés\PHOTOS\PNG\1080x1920")

print(search.stats)

{'directory': ['D:\\Fichiers conservés\\PHOTOS\\PNG\\1080x1920'], 'duration': {'start_date': '2023-02-26', 'start_time': '13:21:26', 'end_date': '2023-02-26', 'end_time': '13:21:34', 'seconds_elapsed': 7.862}, 'fast_search': True, 'recursive': True, 'match_mse': 200, 'files_searched': 0, 'matches_found': 0, 'invalid_files': 133}

Halogenes commented 1 year ago

I ran the same code with different versions and exactly the same images.

v3.0.3 : Does not work v3.0.2 : Does not work v3.0.1 : Works very well ! (see below)

{'directory': ('D:\\Fichiers conservés\\PHOTOS\\PNG\\1080x1920',), 'duration': {'start_date': '2023-02-26', 'start_time': '13:30:57', 'end_date': '2023-02-26', 'end_time': '13:31:06', 'seconds_elapsed': 9.0692}, 'fast_search': True, 'recursive': True, 'match_mse': 200, 'files_searched': 133, 'matches_found': 24, 'invalid_files': 0}

Good luck finding the problem and thanks again for the work :)

(Curious to know what the problem was when you solve it)

elisemercury commented 1 year ago

Hi @Halogenes,

Thanks for opening the issue! I assume the issue is due to the change from opencv to Pillow (as Pillow is faster and more lightweight). It is likely, that Pillow decodes the images differently and throws an error for certain types of images. If possible, could you please share one (or more) of the images with me, so that I can test what the issue is related to? That would be of great help. You can share the image with me via elisejlandman@hotmail.com. I will work on fixing the issue ASAP!

The issue you experienced is likely related to the Pillow package. Pillow made some adjustments with versions >9.1.0 that can affect difPy in the background, depending on which one is installed on your PC. The issue has now been fixed with difPy v3.0.4. Please update it and let me know if the issue is fixed from your end as well.

Thank you and best regards, Elise

Halogenes commented 1 year ago

Sorry for my late reply.

I tried to run exactly the same code, with the same photos using the latest version available (v 3.0.7) and I'm pleased to say that everything works perfectly!

{'directory': ['D:\\Fichiers conservés\\PHOTOS\\PNG\\1080x1920'], 'duration': {'start_date': '2023-03-09', 'start_time': '10:45:55', 'end_date': '2023-03-09', 'end_time': '10:46:10', 'seconds_elapsed': 14.6431}, 'fast_search': True, 'recursive': True, 'match_mse': 200, 'files_searched': 133, 'matches_found': 24, 'invalid_files': {'count': 0}

Congratulations for your work :)