/usr/lib/python2.7/dist-packages/remotecv/image.py is in python-remotecv 2.2.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from io import BytesIO
from PIL import Image as PilImage
PilImage.IGNORE_DECODING_ERRORS = True
PilImage.MAXBLOCK = 2 ** 25
class Image:
@classmethod
def create_from_buffer(cls, image_buffer):
instance = cls()
return instance.parse_image(image_buffer)
def parse_image(self, image_buffer):
tmp = BytesIO(image_buffer)
try:
img = PilImage.open(tmp)
if hasattr(img, 'is_animated') and img.is_animated:
return None
except IOError:
return None
try:
img.load()
except IOError:
pass
img = img.convert('L')
tmp.close()
return img
|