MCPcopy Create free account
hub / github.com/SwinTransformer/Transformer-SSL / pil_loader

Function pil_loader

data/cached_image_folder.py:179–189  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

177
178
179def pil_loader(path):
180 # open path as file to avoid ResourceWarning (https://github.com/python-pillow/Pillow/issues/835)
181 if isinstance(path, bytes):
182 img = Image.open(io.BytesIO(path))
183 elif is_zip_path(path):
184 data = ZipReader.read(path)
185 img = Image.open(io.BytesIO(data))
186 else:
187 with open(path, 'rb') as f:
188 img = Image.open(f)
189 return img.convert('RGB')
190
191
192def accimage_loader(path):

Callers 2

accimage_loaderFunction · 0.85
default_img_loaderFunction · 0.85

Calls 2

is_zip_pathFunction · 0.85
readMethod · 0.80

Tested by

no test coverage detected