|
26 | 26 |
|
27 | 27 | import base64
|
28 | 28 | import copy
|
| 29 | +import datetime |
29 | 30 | import io
|
30 | 31 | import os
|
31 | 32 | import re
|
32 |
| -import datetime |
| 33 | +import sys |
33 | 34 | import warnings
|
34 | 35 | import numpy as np
|
35 | 36 | import pandas as pd
|
@@ -1236,21 +1237,23 @@ class Image(CASDataMsgHandler):
|
1236 | 1237 | ... CASTable('MYTABLE', caslib='CASUSER(user)')
|
1237 | 1238 |
|
1238 | 1239 | """
|
1239 |
| - |
1240 | 1240 | def __init__(self, data, nrecs=1000, subdirs=True):
|
1241 |
| - |
1242 | 1241 | # To maintain Py2.7 compatibility, use strings instead of Paths.
|
1243 | 1242 | if type(data).__module__ == 'pathlib':
|
1244 | 1243 | data = str(data)
|
1245 | 1244 |
|
1246 | 1245 | if isinstance(data, str):
|
1247 | 1246 | files = []
|
| 1247 | + extensions = ['bmp', 'dib', 'jpg', 'jpeg', 'jpe', 'jp2', 'png', 'pbm', 'pmg', |
| 1248 | + 'ppm', 'tif', 'tiff', 'webp'] |
1248 | 1249 |
|
1249 |
| - # Search for all images in the directory and (optionally) in subdirectories |
1250 |
| - for extension in ( |
1251 |
| - 'bmp', 'dib', 'jpg', 'jpeg', 'jpe', 'jp2', 'png', 'pbm', 'pmg', 'ppm', |
1252 |
| - 'tif', 'tiff', 'webp'): |
| 1250 | + # Also search for uppercase file extensions if not running on a |
| 1251 | + # case-insensitive OS (Windows). |
| 1252 | + if not sys.platform.startswith('win'): |
| 1253 | + extensions += [x.upper() for x in extensions] |
1253 | 1254 |
|
| 1255 | + # Search for all images in the directory and (optionally) in subdirectories |
| 1256 | + for extension in extensions: |
1254 | 1257 | if subdirs:
|
1255 | 1258 | pattern = os.path.join(data, '**', '*.%s' % extension)
|
1256 | 1259 | else:
|
|
0 commit comments