I think we can swap out img_path.split('.')[-1].lower() for [PurePath.suffix].(https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.suffix)
|
if img_path.split('.')[-1].lower() in ['jpg', 'jpeg', 'jpe', 'png', 'bmp', 'ppm', 'pbm', 'pgm', 'sr', 'ras']: |
reference_link