Skip to main content

MetaZap

MetaZap is a powerful Python library designed for efficient removal and replacement of metadata from various image file formats. Perfect for photographers, developers, and privacy-conscious users seeking to maintain control over their digital image information.

Table of Contents

  1. Quick Start
  2. Key Features
  3. System Requirements
  4. Comprehensive Usage Guide
  5. Detailed API Documentation
  6. Troubleshooting and Support
  7. Contribution Guidelines
  8. Third-Party Library Acknowledgments
  9. Licensing Information

Quick Start

Get started with MetaZap in seconds:

pip install metazap

Key Features

  • Selective Metadata Removal: Precisely remove specific metadata fields from image files
  • Custom Metadata Replacement: Replace existing metadata with user-defined values
  • Batch Processing: Efficiently handle individual files or entire directories
  • Wide Format Support: Compatible with JPEG, PNG, HEIF, AVIF, and JXL image formats
  • Privacy-Focused: Ideal for removing sensitive information from images

System Requirements

  • Python 3.x environment
  • Pillow (PIL) library with full metadata capabilities
  • piexif library for comprehensive EXIF metadata manipulation
  • pillow-avif library for AVIF image format support

Comprehensive Usage Guide

Single File Operations

Remove specific metadata fields:

from metazap import remove_fields_from_file

remove_fields_from_file("original.jpg", ["Artist", "Copyright"], "cleaned.jpg")

Replace metadata fields:

from metazap import replace_fields_in_file

replace_fields_in_file("original.jpg", {"Artist": "Jane Doe", "Copyright": "2024"}, "updated.jpg")

Remove and replace metadata fields:

from metazap import remove_and_replace_fields_in_file

remove_and_replace_fields_in_file("original.jpg", ["GPSInfo"], {"Artist": "Jane Doe"}, "processed.jpg")

Bulk Directory Processing

import metazap as mz

INPUT_DIR = "raw_images"
OUTPUT_DIR = "processed_images"

SENSITIVE_FIELDS = [
    "GPSInfo",
    "SerialNumber",
    "CameraSerialNumber",
    "ImageDescription",
    "CameraOwnerName",
]

DEFAULT_METADATA = {
    "Artist": "Anonymous",
    "Creator": "Anonymous",
    "Copyright": "All Rights Reserved",
    "License": "CC BY-NC-ND 4.0",
    "DateTime": "2024:01:01 00:00:00",
}

def main():
    mz.remove_and_replace_fields_in_dir(INPUT_DIR, SENSITIVE_FIELDS, DEFAULT_METADATA, OUTPUT_DIR)

if __name__ == "__main__":
    main()

Detailed API Documentation

Core Functions

  • remove_fields_from_file(input_file: Union[str, Path], fields_to_remove: List[str], output_file: Union[str, Path]) -> None
  • replace_fields_in_file(input_file: Union[str, Path], fields_to_replace: Dict[str, str], output_file: Union[str, Path]) -> None
  • remove_and_replace_fields_in_file(input_file: Union[str, Path], fields_to_remove: List[str], fields_to_replace: Dict[str, str], output_file: Union[str, Path]) -> None
  • remove_fields_from_dir(input_dir: Union[str, Path], fields_to_remove: List[str], output_dir: Union[str, Path]) -> None
  • replace_fields_in_dir(input_dir: Union[str, Path], fields_to_replace: Dict[str, str], output_dir: Union[str, Path]) -> None
  • remove_and_replace_fields_in_dir(input_dir: Union[str, Path], fields_to_remove: List[str], fields_to_replace: Dict[str, str], output_dir: Union[str, Path]) -> None
  • process_image(input_path: Path, output_path: Path, fields_to_remove: List[str], fields_to_replace: Dict[str, str]) -> None
  • process_directory(input_dir: Union[str, Path], output_dir: Union[str, Path], fields_to_remove: List[str], fields_to_replace: Dict[str, str]) -> None

For detailed parameter descriptions and return types, refer to the inline documentation or generated API docs.

Troubleshooting and Support

Encountering issues? Follow these steps:

  1. Verify all dependencies are correctly installed and up-to-date
  2. Check console output for specific error messages
  3. For unresolved issues, open a GitHub issue with a detailed description and steps to reproduce

Contribution Guidelines

We welcome contributions from the community! To contribute:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

Please adhere to our coding standards and include unit tests for new features.

Third-Party Library Acknowledgments

MetaZap leverages these excellent open-source libraries:

  • Pillow: Versatile imaging library for Python
  • piexif: Powerful EXIF metadata manipulation
  • pillow-avif: AVIF format support for Pillow

We extend our gratitude to the developers of these projects for their invaluable contributions to the Python ecosystem.

Licensing Information

MetaZap is licensed under the Apache License, Version 2.0 with important additional terms, including specific commercial use conditions. Users are strongly advised to read the full LICENSE file carefully before using, modifying, or distributing this work. The additional terms contain crucial information about liability, data collection, indemnification, and commercial usage requirements that may significantly affect your rights and obligations.


Keywords: MetaZap, image metadata, EXIF removal, privacy protection, Python library, batch processing, JPEG, PNG, HEIF, AVIF, JXL, image anonymization, metadata management, digital photography, image processing, data privacy, open-source tool, Pillow, piexif, image security

Metadata

Release files for metazap 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metazap 0.4.0
File Size Uploaded
metazap-0.4.0.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for metazap 0.4.0
File Interpreter ABI Platform
metazap-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.0 kB

Release files / metazap-0.4.0.tar.gz

Download URL metazap-0.4.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e4089371dc88152ae84158d165a511bf5e791aba5e3d0f3d111f7f89f233a6c2
BLAKE2b-256 checksum
How to use checksums
0cb7b0fa5ee89a0561c22319bd423dc5dcf8067ce4b9d8eb12edf410f22f32e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / metazap-0.4.0-py3-none-any.whl

Download URL metazap-0.4.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9008bb0f3c7b1e4381af908da9115603c8c494559753525dab88ac37dd4dfc6
BLAKE2b-256 checksum
How to use checksums
8724d73560b482e9528db077065179ffd2b5df1a6f53083ff486e855fc47c5c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page