Skip to main content

A library for manipulating metadata in image files

Project description

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")

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: str, fields_to_remove: List[str], output_file: str) -> None
  • replace_fields_in_file(input_file: str, fields_to_replace: Dict[str, str], output_file: str) -> None
  • remove_fields_from_dir(input_dir: str, fields_to_remove: List[str], output_dir: str) -> None
  • replace_fields_in_dir(input_dir: str, fields_to_replace: Dict[str, str], output_dir: str) -> None
  • process_image(input_path: str, output_path: str, fields_to_remove: List[str], fields_to_replace: Dict[str, str]) -> None
  • process_directory(input_dir: str, output_dir: str, 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metazap-0.3.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

metazap-0.3.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file metazap-0.3.0.tar.gz.

File metadata

  • Download URL: metazap-0.3.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for metazap-0.3.0.tar.gz
Algorithm Hash digest
SHA256 229a493d5fcb1b39da7efbac8d07f7c11992a525c33fbee93669cbeadf6a543e
MD5 41900cca55d450aa9d717b791fb16b69
BLAKE2b-256 33f6d55b92233c3d75f81f09ab5b482cf8e9daf4631ee9ba6f2c2851e1e1920f

See more details on using hashes here.

File details

Details for the file metazap-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: metazap-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for metazap-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 570f421fa3139cab51ee3855e312cc4877f800a0c32d4ed15ac4d5dcbc6c80f6
MD5 d96ebd8da039dcc28269555197098b1c
BLAKE2b-256 c5784b1c53e4570e55c5888424ec7e8b4d6efe0bf889994b38c317db4ee79a7d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page