(path)
| 169 | |
| 170 | |
| 171 | def pil_loader(path): |
| 172 | # open path as file to avoid ResourceWarning (https://github.com/python-pillow/Pillow/issues/835) |
| 173 | if isinstance(path, bytes): |
| 174 | img = Image.open(io.BytesIO(path)) |
| 175 | elif is_zip_path(path): |
| 176 | data = ZipReader.read(path) |
| 177 | img = Image.open(io.BytesIO(data)) |
| 178 | else: |
| 179 | with open(path, 'rb') as f: |
| 180 | img = Image.open(f) |
| 181 | return img.convert('RGB') |
| 182 | |
| 183 | |
| 184 | def accimage_loader(path): |
no test coverage detected