Added further extension variation acceptance and made extensions properly case insensitive (#188)

This commit is contained in:
Ullallulloo 2016-09-20 07:36:43 -05:00 committed by Brandon Amos
parent 97f30d5d05
commit 35c99507a6
1 changed files with 2 additions and 2 deletions

View File

@ -104,11 +104,11 @@ def iterImgs(directory):
""" """
assert directory is not None assert directory is not None
exts = [".jpg", ".png", ".JPG", ".PNG"] exts = [".jpg", ".jpeg", ".png"]
for subdir, dirs, files in os.walk(directory): for subdir, dirs, files in os.walk(directory):
for path in files: for path in files:
(imageClass, fName) = (os.path.basename(subdir), path) (imageClass, fName) = (os.path.basename(subdir), path)
(imageName, ext) = os.path.splitext(fName) (imageName, ext) = os.path.splitext(fName)
if ext in exts: if ext.lower() in exts:
yield Image(imageClass, imageName, os.path.join(subdir, fName)) yield Image(imageClass, imageName, os.path.join(subdir, fName))