def getJpegInfo(path): """ @summary: Gets jpeg information. @return: Tuple with exif info, exif2 info and comments. """ try: infoExif = jpeg.getExif(path) __log__.debug("Gets EXIF information %s" % infoExif) except Exception: __log__.warning("It could not get EXIF information from %s" % path) infoExif = None try: infoExif2 = jpeg.getExif2(path) __log__.debug("Gets EXIF2 information %s" % infoExif2) except Exception: __log__.warning("It could not get EXIF2 information from %s" % path) infoExif2 = None try: infoComments = jpeg.getComments(path) __log__.debug("Gets comments %s" % infoComments) except Exception: __log__.warning("It could not get comments information from %s" % path) infoComments = None return (infoExif, infoExif2, infoComments)
def __get__(self, photo, cls=None): exif = getattr(photo, '_exif', None) if exif is None: exif_tags = jpeg.getExif(photo.fspath) if exif_tags is None: exif = [] else: exif = exif_tags.exif photo._exif = exif for tag in exif: if tag.intID == self.id: return self._to_python(tag.value)
#!/usr/bin/env python # http://www.emilas.com/jpeg/ from jpeg import jpeg import sys path_input = sys.argv[1] path_output = sys.argv[2] try: exif = jpeg.getExif(path_input) except Exception, e: # please to write to STDERR here... print "get exif: %s (%s)" % (e, path_input) sys.exit() if exif != None: try: jpeg.setExif(exif, path_output) except Exception, e: # please to write to STDERR here... print "set exif: %s (%s)" % (e, path_output) sys.exit() sys.exit()
#!/usr/bin/env python # http://www.emilas.com/jpeg/ from jpeg import jpeg import sys path_input = sys.argv[1] path_output = sys.argv[2] try : exif = jpeg.getExif(path_input) except Exception, e: # please to write to STDERR here... print "get exif: %s (%s)" % (e, path_input) sys.exit() if exif != None : try : jpeg.setExif(exif, path_output) except Exception, e : # please to write to STDERR here... print "set exif: %s (%s)" % (e, path_output) sys.exit() sys.exit()