The function preprocess_image in goldberg.py has a use case when bytestream=False, img_or_path=<bytes> -> from line 226:
if bytestream:
try:
img = Image.open(BytesIO(image_or_path))
except IOError:
# could be an svg, attempt to convert
.
.
.
.
elif type(image_or_path) is bytes:
try:
img = Image.open(image_or_path)
arr = np.array(img.convert('RGB'))
except IOError:
# try again due to PIL weirdness
return imread(image_or_path, as_grey=True)
I have tried to understand where this could be applicable as an edge case and fail to do so?
In the scenario where I think it might be relevant is if someone does something like:
with open("file.jpg","rb") as f:
sig = ImageSignature().generate_signature(f.read(), bytestream=False)
The function
preprocess_image
ingoldberg.py
has a use case whenbytestream=False, img_or_path=<bytes>
-> from line 226:I have tried to understand where this could be applicable as an edge case and fail to do so? In the scenario where I think it might be relevant is if someone does something like:
But that would just lead to an error.