def __init__(self, stream): self.stream = stream try: self.img = PIL.Image.open(self.stream) except IOError: raise errors.ImageFormatError("File is not an image") if self.img.format.lower() not in self.FORMATS: raise errors.ImageFormatError("Unknown format: %s" % self.img.format) self._orig_format = self.img.format
def __init__(self, stream): self.stream = stream self._skip_background = False try: self.img = PIL.Image.open(self.stream) except IOError: raise errors.ImageFormatError("File is not an image") # Cache original Exif data, since it can be erased by some operations self._exif = self.img.info.get('exif', b'') if self.img.format.lower() not in self.FORMATS: raise errors.ImageFormatError("Unknown format: %s" % self.img.format) self._orig_format = self.img.format
def __init__(self, stream): self.stream = stream self.img = PIL.Image.open(self.stream) if self.img.format.lower() not in self.FORMATS: raise errors.ImageFormatError("Unknown format: %s" % self.img.format) self._orig_format = self.img.format