elisemercury / Duplicate-Image-Finder

difPy - Python package for finding duplicate and similar images
https://difpy.readthedocs.io
MIT License
466 stars 67 forks source link

PNGs with transparency are mistakenly counted as duplicate and not rendered properly in GUI compare #30

Closed SPRCoreDump closed 2 years ago

SPRCoreDump commented 2 years ago

Great tool! I learned a lot reading the article you wrote about this as well.

I tested it on some of my files, but found that I had some PNGs that were just line-art (black line-art on transparent background) were flagged as duplicate when they were completely different, even on high sensitivity. In fact, the listed MSE is 0.00

They also did not render properly during the image comparison when running -d False, with both image previews looking like black squares. Note: This does not apply to line-art of a different color on transparent background, only black.

I am not familiar with how the PNG file format encodes black vs transparent, but I believe that the issue stems from that.

Screen Shot 2022-07-22 at 1 57 07 AM

SPRCoreDump commented 2 years ago

After some further testing, I've found that it seems .jpg images also suffer from incorrectly being identified as duplicate images. black and white comic strips and manga panels are marked as duplicate with an MSE of 0.00, even with -s High and -px 200. Could this be because the comparison step is not sensitive enough to differentiate tensors without the extra information that comes with color?

elisemercury commented 2 years ago

Hi @SPRCoreDump, Thanks a lot for opening the issue and for your input! Indeed, I agree and think that there must be some kind of issue related to lack of information in black and white images, same for PNG transparency. I will have a look at these issues ASAP and let you know as soon as I have a fix for it. Again thanks and all the best, Elise

elisemercury commented 2 years ago

Hi @SPRCoreDump, I tried reproducing the issue you encountered, but for me it works fine with various transparent PNG images and back and white manga comic strips... Would you mind sending me your images, so that I can try reproducing the issue locally? That would be a great help. You can attach them either to a comment here, or send them to me via e-mail. Thanks a lot! All the best Elise

elisemercury commented 2 years ago

As I did not get any update around this issue, I will proceed with its closing. @SPRCoreDump feel free to still attach the respective images to this issue in the future. Thanks, Elise