Strip Image AI Metadata
Platforms like LinkedIn read C2PA metadata embedded by AI image generators (ChatGPT, DALL-E, Midjourney, etc.) and display an attribution label. This skill removes that metadata without re-encoding, so image quality is preserved.
Supported formats
- PNG: removes
caBXchunks and AI-relatedtEXt/iTXt/zTXtchunks - JPEG: removes APP11 C2PA segments and AI-related APP1 (XMP/EXIF) segments
- WebP: removes
C2PAchunks and C2PA-related payload
Quick use
Run the bundled script on one or more images:
python3 scripts/strip_c2pa.py image.png # strips metadata + renames to IMG_YYYYMMDD_HHMMSS.png
python3 scripts/strip_c2pa.py image.jpg -o cleaned.jpg
python3 scripts/strip_c2pa.py *.png
By default the script writes a cleaned copy with a neutral camera-style filename (IMG_YYYYMMDD_HHMMSS.<ext>) in the same directory and leaves the original untouched. Use -i/--in-place to overwrite the original, or -o for an explicit output path.
Workflow
-
Inspect (optional): If the user is unsure whether an image has C2PA metadata, run:
strings image.png | grep -i c2paor read PNG chunks with Python to look for
caBX. -
Strip: Run
scripts/strip_c2pa.py <path>. The script writes a neutral-named copy by default and reports what was removed. -
Verify: The script automatically scans the output for remaining C2PA/AI keywords and warns if any are found.
What this does NOT do
- It does not remove visible watermarks baked into pixels.
- It does not strip standard EXIF metadata unless it contains AI attribution keywords.
- It does not re-encode, so file size and image quality are unchanged (except for the removed metadata).
When to re-encode instead
If the platform still shows an AI label after stripping, the attribution might be baked into pixels or stored in a non-C2PA format. In that case, use ImageMagick to decode and re-encode:
convert input.png -strip output.png
This is lossless for PNG but may cause slight quality loss for JPEG.