Quickstart Guide¶
This guide will help you get up and running with tagkit quickly.
Basic Usage¶
Working with Multiple Images¶
from tagkit import ExifImageCollection
# Create a collection from multiple images
collection = ExifImageCollection(["image1.jpg", "image2.jpg", "image3.jpg"])
# Print all tags as dictionary
print(collection.as_dict())
# Process each image in the collection
for file_path, exif_image in collection.files.items():
print(f"Processing {file_path}")
# Get camera make and model
try:
make = exif_image.tags["Make"].value
model = exif_image.tags["Model"].value
print(f"Camera: {make} {model}")
except KeyError:
print("Camera information not available")
# Add copyright information
exif_image.write_tag("Copyright", "© 2025 Your Name")
exif_image.save()
# Set a tag for all images in the collection
collection.write_tag("Artist", "John Doe")
# Set multiple tags for all images in the collection
multi_tag_dict = {
"Artist": "Photographer Name",
"Copyright": "© 2025 Your Name"
}
collection.write_tags(multi_tag_dict)
# Remove a tag from all images
collection.delete_tag("Artist")
# Remove multiple tags from all images
collection.delete_tags(["Artist", "Copyright"])
# Set a tag for a single image
collection.write_tag("Artist", "Jane", files=["image2.jpg"])
# Remove a tag from a single image
collection.delete_tag("Artist", files=["image2.jpg"])
# Remove multiple tags from a single image
collection.delete_tags(["Artist", "Copyright"], files=["image2.jpg"])
# Save all changes to all images, making a backup of each
collection.save_all(create_backup=True)