def getExif(self): """ Look for an Exif segment, and return as an Exif object. If no segment is found, an empty Exif object is returned. """ import exif for s in self._segments: if s[0] == APP_1 and s[1][:5] == "Exif\0": return exif.Exif(s[1][6:]) return exif.Exif()
def getExif(file): "return FFE1 Exif segment (APP1) from a JPEG file, wrapped into an Exif instance object" exifSeg = _read(file, "\xE1") if not exifSeg in (None, ""): return exif.Exif(exifSeg, "\xE1") else: return getExif2(file)
def _read(self): self.extra_zero = self._io.read_bytes(1) if not self.extra_zero == b"\x00": raise kaitaistruct.ValidationNotEqualError( b"\x00", self.extra_zero, self._io, u"/types/exif_in_jpeg/seq/0") self._raw_data = self._io.read_bytes_full() _io__raw_data = KaitaiStream(BytesIO(self._raw_data)) self.data = exif.Exif(_io__raw_data)
def getExif2(file): #extended "return FFE2 extended Exif segment (APP2) from a JPEG file, wrapped into an Exif instance object" exifSeg = _read(file, "\xE2") if not exifSeg in (None, ""): return exif.Exif(exifSeg, "\xE2")
def loadExif(self): # Read the Exif data self.exif = exif.Exif(self.exif_offset, self.offset, fp=self.fp, big_endian=self.big_endian)