How to use the pyexiv2.metadata.ImageMetadata function in pyexiv2

To help you get started, we’ve selected a few pyexiv2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github theopolisme / theobot / NonFreeImageResizer / littleimage.py View on Github external
def metadata(source_path, dest_path, image):
	"""This function moves the metadata
	from the old image to the new, reduced
	image using pyexiv2.
	"""
	source_image = pyexiv2.metadata.ImageMetadata(source_path)
	source_image.read()
	dest_image = pyexiv2.metadata.ImageMetadata(dest_path)
	dest_image.read()
	source_image.copy(dest_image)
	dest_image["Exif.Photo.PixelXDimension"] = image.size[0]
	dest_image["Exif.Photo.PixelYDimension"] = image.size[1]
	dest_image.write()
github fasaxc / shotwell-iphoto-import / iphoto_import.py View on Github external
def read_metadata(path, photo, prefix="orig_"):
                photo[prefix + "orientation"] = 1
                photo[prefix + "original_orientation"] = 1
                try:
                    meta = ImageMetadata(path)
                    meta.read()
                    try:
                        photo[prefix + "orientation"] = meta["Exif.Image.Orientation"].value
                        photo[prefix + "original_orientation"] = meta["Exif.Image.Orientation"].value
                    except KeyError:
                        print
                        _log.debug("Failed to read the orientation from %s" % path)
                    exposure_dt = meta["Exif.Image.DateTime"].value
                    photo[prefix + "exposure_time"] = exif_datetime_to_time(exposure_dt)
                except KeyError:
                    pass
                except Exception:
                    print
                    _log.exception("Failed to read date from %s", path)
                    raise
github theopolisme / theobot / NonFreeImageResizer / littleimage.py View on Github external
def metadata(source_path, dest_path, image):
	"""This function moves the metadata
	from the old image to the new, reduced
	image using pyexiv2.
	"""
	source_image = pyexiv2.metadata.ImageMetadata(source_path)
	source_image.read()
	dest_image = pyexiv2.metadata.ImageMetadata(dest_path)
	dest_image.read()
	source_image.copy(dest_image)
	dest_image["Exif.Photo.PixelXDimension"] = image.size[0]
	dest_image["Exif.Photo.PixelYDimension"] = image.size[1]
	dest_image.write()