How to use the exif.TiffImageFileDirectory function in exif

To help you get started, we’ve selected a few exif 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 albertz / helpers / exif.py View on Github external
head = file.read(8)
	exif = {}
	
	# process dictionary
	info = TiffImageFileDirectory(head)
	info.load(file)
	for key, value in info.items():
		exif[key] = fixup(value)
	
	# get exif extension
	try:
		file.seek(exif[0x8769])
	except KeyError:
		pass
	else:
		info = TiffImageFileDirectory(head)
		info.load(file)
		for key, value in info.items():
			exif[key] = fixup(value)
	
	# get gpsinfo extension
	try:
		file.seek(exif[0x8825])
	except KeyError:
		pass
	else:
		info = TiffImageFileDirectory(head)
		info.load(file)
		exif[0x8825] = gps = {}
		for key, value in info.items():
			gps[key] = fixup(value)

exif

Read and modify image EXIF metadata using Python.

MIT
Latest version published 2 years ago

Package Health Score

72 / 100
Full package analysis