MCPcopy
hub / github.com/DingXiaoH/RepVGG / pil_loader

Function pil_loader

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

Source from the content-addressed store, hash-verified

169
170
171def 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
184def 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