Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f39d408

Browse files
committed
Remove duplicates: Also output sha256 of files.
1 parent de566df commit f39d408

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

python3/remove-duplicates.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"""
1111

1212
import argparse
13+
import hashlib
1314
import imagehash
1415
import os
1516
import sys
@@ -62,6 +63,12 @@ def runOnClass(args, imgs):
6263
imgs.remove(largestImg)
6364
for img in imgs:
6465
os.remove(img)
66+
67+
if args.sha256:
68+
print("")
69+
for img in imgs:
70+
print(hashlib.sha256(open(img, 'rb').read()).hexdigest())
71+
print("")
6572
return numFound
6673

6774
if __name__ == '__main__':
@@ -72,6 +79,8 @@ def runOnClass(args, imgs):
7279
parser.add_argument('--delete', action='store_true',
7380
help="Delete the smallest duplicate images instead "
7481
"of just listing them.")
82+
parser.add_argument('--sha256', action='store_true',
83+
help="Show sha256 sum for duplicate images")
7584
args = parser.parse_args()
7685

7786
numFound = 0

0 commit comments

Comments
 (0)