Skip to main content

Remove metadata from image datasets before VLM training or ingestion to reduce hidden prompt injection risk.

Project description

metaclean-vlm

Remove metadata from image datasets before VLM training or ingestion to reduce hidden prompt injection risk.

PyPI License: MPL-2.0

Installation

pip install metaclean-vlm

Usage

from metaclean_vlm import clean_images

report = clean_images("raw_images", "clean_images")
print(report)

Bulk clean a dataset

from metaclean_vlm import clean_dataset

report = clean_dataset("dataset/raw", "dataset/clean")
print(report)

clean_dataset recursively processes supported images and preserves folder structure.

Output

[
    {
        "input": "raw_images/example.jpg",
        "output": "clean_images/example.jpg",
        "format": "JPEG",
        "metadata_found": True,
        "metadata_keys": ["exif", "icc_profile"],
        "ok": True,
        "error": None,
    }
]

Clean one image

from metaclean_vlm import clean_image

result = clean_image("image.jpg", "image.clean.jpg")
print(result)

Inspect metadata

from metaclean_vlm import inspect_metadata

metadata = inspect_metadata("image.jpg")
print(metadata)

Overview

metaclean-vlm is a tiny Python utility for removing metadata from image datasets before they are used in VLM pipelines. It is aimed at reducing the risk of hidden prompt injection or unwanted instructions stored in image metadata.

It is useful when building:

  • VLM training datasets
  • multimodal AI pipelines
  • image ingestion systems
  • dataset cleaning workflows
  • AI safety preprocessing tools

Features

  • Removes common image metadata
  • Cleans batches and full image datasets
  • Supports JPEG, PNG, WEBP, TIFF, and BMP
  • Preserves folder structure
  • Returns a simple cleaning report
  • Uses Pillow
  • Simple API

Limitations

metaclean-vlm removes metadata by re-encoding image pixels without metadata fields. It is not a complete security scanner and does not protect against steganography, visible prompt injection, OCR-based attacks, adversarial images, poisoned pixels, or malicious image content. Use it as one dataset hygiene layer, not as your only security control.

Issues

Report issues at: https://github.com/edujbarrios/metaclean-vlm

Author

Eduardo J. Barrios
edujbarrios@outlook.com

License

Mozilla Public License 2.0

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

metaclean_vlm-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metaclean_vlm-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file metaclean_vlm-0.1.0.tar.gz.

File metadata

  • Download URL: metaclean_vlm-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for metaclean_vlm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fbc3912c89b63d9bb3123ea9b9d6f3176fc15a438eaa2c294721458576bb53f9
MD5 5c5313025f0b49fd0fa487e5ed140581
BLAKE2b-256 649ea961f736e72886134f10a7a943d9e45bce8be4dca59d1c4f66b250fec703

See more details on using hashes here.

File details

Details for the file metaclean_vlm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: metaclean_vlm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for metaclean_vlm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b263f701d8d67a966472cbde4ccbf985ab402162d03db0a7f1e0525d66eac87
MD5 59af619796396a7c3cc5da2383064f3b
BLAKE2b-256 2cc209446b7d3416d693f66e7684acb94a0b4d083baafa3785cb9a44657bbbc2

See more details on using hashes here.

Supported by

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