-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added script to delete broken images on raffer * added condition to check for broken images * added pillow as requirement
- Loading branch information
Showing
4 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os | ||
import argparse | ||
from PIL import Image | ||
|
||
# construct the argument parse and parse the arguments | ||
ap = argparse.ArgumentParser() | ||
ap.add_argument("-f", "--folder", required=True, | ||
help="path to the images") | ||
args = vars(ap.parse_args()) | ||
|
||
for filename in os.listdir(args["folder"]): | ||
if filename.endswith(".jpg"): | ||
f = os.path.join(args["folder"], filename) | ||
# checking if it is a file | ||
if os.path.isfile(f): | ||
try: | ||
im = Image.open(f) | ||
verify = im.verify() | ||
except: | ||
print(f'{f} has errors, deleting it...') | ||
os.remove(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
numpy==1.22.4 | ||
imutils==0.5.4 | ||
opencv-python==4.5.5.64 | ||
pillow==9.0.1 |