# 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](#quick-start)
2. [Key Features](#key-features)
3. [System Requirements](#system-requirements)
4. [Comprehensive Usage Guide](#comprehensive-usage-guide)
5. [Detailed API Documentation](#detailed-api-documentation)
6. [Troubleshooting and Support](#troubleshooting-and-support)
7. [Contribution Guidelines](#contribution-guidelines)
8. [Third-Party Library Acknowledgments](#third-party-library-acknowledgments)
9. [Licensing Information](#licensing-information)
## Quick Start
Get started with MetaZap in seconds:
```bash
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:
```python
from metazap import remove_fields_from_file
remove_fields_from_file("original.jpg", ["Artist", "Copyright"], "cleaned.jpg")
```
Replace metadata fields:
```python
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:
```python
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
```python
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](https://python-pillow.org/): Versatile imaging library for Python
- [piexif](https://github.com/hMatoba/Piexif): Powerful EXIF metadata manipulation
- [pillow-avif](https://github.com/fdintino/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](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
Raw data
{
"_id": null,
"home_page": "https://github.com/ZuidVolt/MetaZap",
"name": "metazap",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "metadata exif image processing",
"author": "zuidvolt",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/0c/b7/b0fa5ee89a0561c22319bd423dc5dcf8067ce4b9d8eb12edf410f22f32e6/metazap-0.4.0.tar.gz",
"platform": null,
"description": "# MetaZap\n\nMetaZap 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.\n\n## Table of Contents\n\n1. [Quick Start](#quick-start)\n2. [Key Features](#key-features)\n3. [System Requirements](#system-requirements)\n4. [Comprehensive Usage Guide](#comprehensive-usage-guide)\n5. [Detailed API Documentation](#detailed-api-documentation)\n6. [Troubleshooting and Support](#troubleshooting-and-support)\n7. [Contribution Guidelines](#contribution-guidelines)\n8. [Third-Party Library Acknowledgments](#third-party-library-acknowledgments)\n9. [Licensing Information](#licensing-information)\n\n## Quick Start\n\nGet started with MetaZap in seconds:\n\n```bash\npip install metazap\n```\n\n## Key Features\n\n- **Selective Metadata Removal**: Precisely remove specific metadata fields from image files\n- **Custom Metadata Replacement**: Replace existing metadata with user-defined values\n- **Batch Processing**: Efficiently handle individual files or entire directories\n- **Wide Format Support**: Compatible with JPEG, PNG, HEIF, AVIF, and JXL image formats\n- **Privacy-Focused**: Ideal for removing sensitive information from images\n\n## System Requirements\n\n- Python 3.x environment\n- Pillow (PIL) library with full metadata capabilities\n- piexif library for comprehensive EXIF metadata manipulation\n- pillow-avif library for AVIF image format support\n\n## Comprehensive Usage Guide\n\n### Single File Operations\n\nRemove specific metadata fields:\n\n```python\nfrom metazap import remove_fields_from_file\n\nremove_fields_from_file(\"original.jpg\", [\"Artist\", \"Copyright\"], \"cleaned.jpg\")\n```\n\nReplace metadata fields:\n\n```python\nfrom metazap import replace_fields_in_file\n\nreplace_fields_in_file(\"original.jpg\", {\"Artist\": \"Jane Doe\", \"Copyright\": \"2024\"}, \"updated.jpg\")\n```\n\nRemove and replace metadata fields:\n\n```python\nfrom metazap import remove_and_replace_fields_in_file\n\nremove_and_replace_fields_in_file(\"original.jpg\", [\"GPSInfo\"], {\"Artist\": \"Jane Doe\"}, \"processed.jpg\")\n```\n\n### Bulk Directory Processing\n\n```python\nimport metazap as mz\n\nINPUT_DIR = \"raw_images\"\nOUTPUT_DIR = \"processed_images\"\n\nSENSITIVE_FIELDS = [\n \"GPSInfo\",\n \"SerialNumber\",\n \"CameraSerialNumber\",\n \"ImageDescription\",\n \"CameraOwnerName\",\n]\n\nDEFAULT_METADATA = {\n \"Artist\": \"Anonymous\",\n \"Creator\": \"Anonymous\",\n \"Copyright\": \"All Rights Reserved\",\n \"License\": \"CC BY-NC-ND 4.0\",\n \"DateTime\": \"2024:01:01 00:00:00\",\n}\n\ndef main():\n mz.remove_and_replace_fields_in_dir(INPUT_DIR, SENSITIVE_FIELDS, DEFAULT_METADATA, OUTPUT_DIR)\n\nif __name__ == \"__main__\":\n main()\n```\n\n## Detailed API Documentation\n\n### Core Functions\n\n- `remove_fields_from_file(input_file: Union[str, Path], fields_to_remove: List[str], output_file: Union[str, Path]) -> None`\n- `replace_fields_in_file(input_file: Union[str, Path], fields_to_replace: Dict[str, str], output_file: Union[str, Path]) -> None`\n- `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`\n- `remove_fields_from_dir(input_dir: Union[str, Path], fields_to_remove: List[str], output_dir: Union[str, Path]) -> None`\n- `replace_fields_in_dir(input_dir: Union[str, Path], fields_to_replace: Dict[str, str], output_dir: Union[str, Path]) -> None`\n- `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`\n- `process_image(input_path: Path, output_path: Path, fields_to_remove: List[str], fields_to_replace: Dict[str, str]) -> None`\n- `process_directory(input_dir: Union[str, Path], output_dir: Union[str, Path], fields_to_remove: List[str], fields_to_replace: Dict[str, str]) -> None`\n\nFor detailed parameter descriptions and return types, refer to the inline documentation or generated API docs.\n\n## Troubleshooting and Support\n\nEncountering issues? Follow these steps:\n\n1. Verify all dependencies are correctly installed and up-to-date\n2. Check console output for specific error messages\n3. For unresolved issues, open a GitHub issue with a detailed description and steps to reproduce\n\n## Contribution Guidelines\n\nWe welcome contributions from the community! To contribute:\n\n1. Fork the repository\n2. Create a feature branch\n3. Commit your changes\n4. Push to the branch\n5. Open a Pull Request\n\nPlease adhere to our coding standards and include unit tests for new features.\n\n## Third-Party Library Acknowledgments\n\nMetaZap leverages these excellent open-source libraries:\n\n- [Pillow](https://python-pillow.org/): Versatile imaging library for Python\n- [piexif](https://github.com/hMatoba/Piexif): Powerful EXIF metadata manipulation\n- [pillow-avif](https://github.com/fdintino/pillow-avif): AVIF format support for Pillow\n\nWe extend our gratitude to the developers of these projects for their invaluable contributions to the Python ecosystem.\n\n## Licensing Information\n\nMetaZap 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](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.\n\n---\nKeywords: 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\n",
"bugtrack_url": null,
"license": "Apache Software License",
"summary": "A library for manipulating metadata in image files",
"version": "0.4.0",
"project_urls": {
"Documentation": "https://github.com/ZuidVolt/MetaZap#readme",
"Homepage": "https://github.com/ZuidVolt/MetaZap",
"Issue Tracker": "https://github.com/ZuidVolt/MetaZap/issues",
"Source Code": "https://github.com/ZuidVolt/MetaZap",
"changelog": "https://github.com/ZuidVolt/MetaZap/releases"
},
"split_keywords": [
"metadata",
"exif",
"image",
"processing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8724d73560b482e9528db077065179ffd2b5df1a6f53083ff486e855fc47c5c5",
"md5": "21b8978da45705f902314f3c64d893d3",
"sha256": "b9008bb0f3c7b1e4381af908da9115603c8c494559753525dab88ac37dd4dfc6"
},
"downloads": -1,
"filename": "metazap-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "21b8978da45705f902314f3c64d893d3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 12188,
"upload_time": "2024-09-04T13:51:12",
"upload_time_iso_8601": "2024-09-04T13:51:12.018536Z",
"url": "https://files.pythonhosted.org/packages/87/24/d73560b482e9528db077065179ffd2b5df1a6f53083ff486e855fc47c5c5/metazap-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0cb7b0fa5ee89a0561c22319bd423dc5dcf8067ce4b9d8eb12edf410f22f32e6",
"md5": "491bce1aa255053e0eb5435155fe12a1",
"sha256": "e4089371dc88152ae84158d165a511bf5e791aba5e3d0f3d111f7f89f233a6c2"
},
"downloads": -1,
"filename": "metazap-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "491bce1aa255053e0eb5435155fe12a1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 13804,
"upload_time": "2024-09-04T13:51:13",
"upload_time_iso_8601": "2024-09-04T13:51:13.483587Z",
"url": "https://files.pythonhosted.org/packages/0c/b7/b0fa5ee89a0561c22319bd423dc5dcf8067ce4b9d8eb12edf410f22f32e6/metazap-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-04 13:51:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ZuidVolt",
"github_project": "MetaZap",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "metazap"
}