cd /news/artificial-intelligence/how-instagram-detects-ai-images-c2pa… · home › topics › artificial-intelligence › article
[ARTICLE · art-173533] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

How Instagram Detects AI Images: C2PA, IPTC and XMP Explained (With Code to Inspect Them)

A developer built AI Flag Remover, a browser-based tool that strips AI-provenance metadata from images, and documented where Instagram's "AI info" labels actually come from: C2PA manifests in JUMBF boxes, the IPTC DigitalSourceType XMP field (trainedAlgorithmicMedia or compositeWithTrainedAlgorithmicMedia), and Stable Diffusion prompt text in PNG tEXt chunks. The writeup includes ExifTool commands plus Python and JavaScript snippets for locating C2PA APP11 segments and PNG text chunks, and notes that removing chunks during a byte-for-byte rebuild avoids re-encoding and quality loss. The developer frames stripping as useful for false positives and privacy, while cautioning that genuinely AI-generated content may still require disclosure under platform rules and the EU AI Act.

recommendation

Inspect images with ExifTool's -DigitalSourceType and -JUMBF:all flags before trusting or clearing an AI label, and rebuild files by skipping metadata chunks rather than re-encoding.

more in playbook: Verifying model output
by read3 min views1 publishedNov 20, 2026

If you've ever seen Instagram put an "AI info" label on a photo you know is real, the cause is almost never the pixels. It's metadata. I've spent the last few months building AI Flag Remover, a browser-based tool that strips this metadata, so here's what I learned about where it lives and how to inspect it yourself.

Signal Where it lives Who writes it Who reads it
C2PA manifest JUMBF boxes (JPEG APP11, PNG caBX chunk, WebPC2PA chunk) Adobe, OpenAI, Google, Microsoft TikTok, LinkedIn, Meta, Pinterest
IPTC Digital Source Type XMP packet, Iptc4xmpExt:DigitalSourceType Meta AI, many generators Meta (Instagram, Facebook, Threads)
Generator text PNG tEXt /iTXt chunks (parameters ,prompt ,workflow ) Stable Diffusion WebUI, ComfyUI, Forge Anyone who opens the file

The IPTC value to look for is a URI ending in trainedAlgorithmicMedia (fully generated) or compositeWithTrainedAlgorithmicMedia (real photo edited with AI). That second one is the usual culprit when a real photo gets labelled after a Generative Fill edit.

The quickest check, if you have ExifTool installed:

exiftool -G1 -a -s -DigitalSourceType -JUMBF:all -XMP-iptcExt:all photo.jpg

exiftool -PNG:Parameters -PNG:Prompt -PNG:Workflow image.png

C2PA in JPEGs sits in APP11 segments containing a JUMBF box labelled c2pa. This scans the segment markers:

import sys

def find_c2pa_jpeg(path):
    data = open(path, "rb").read()
    i = 2  # skip SOI
    found = []
    while i < len(data) - 4 and data[i] == 0xFF:
        marker = data[i + 1]
        length = int.from_bytes(data[i + 2:i + 4], "big")
        segment = data[i + 4:i + 2 + length]
        if marker == 0xEB and b"c2pa" in segment:      # APP11 + JUMBF label
            found.append(("APP11/C2PA", length))
        if marker == 0xE1 and b"DigitalSourceType" in segment:  # APP1 XMP
            found.append(("XMP/DigitalSourceType", length))
        if marker == 0xDA:  # start of scan, image data follows
            break
        i += 2 + length
    return found

print(find_c2pa_jpeg(sys.argv[1]) or "No AI metadata markers found")

Stable Diffusion prompts are plain tEXt chunks, so a few lines of JavaScript can read them client-side:

async function readPngText(file) {
  const buf = new DataView(await file.arrayBuffer());
  const out = {};
  let p = 8; // skip PNG signature
  while (p < buf.byteLength) {
    const len = buf.getUint32(p);
    const type = String.fromCharCode(...new Uint8Array(buf.buffer, p + 4, 4));
    if (type === "tEXt") {
      const bytes = new Uint8Array(buf.buffer, p + 8, len);
      const [key, ...val] = new TextDecoder("latin1").decode(bytes).split("\0");
      out[key] = val.join("\0");
    }
    if (type === "caBX") out.c2pa = `${len} bytes`;
    p += 12 + len; // length + type + data + CRC
  }
  return out; // e.g. { parameters: "a cat, 8k ... Steps: 30, Seed: 1234" }
}

Removing a chunk is just skipping it when you rebuild the file. Because you're copying the image data chunks byte for byte, there's no re-encoding and no quality loss.

IFD1 too if privacy matters. C2PA exists for good reasons: provenance helps people spot fakes. Stripping it makes sense for false positives (real photos with a minor AI edit) and privacy (GPS, serial numbers, leaked prompts). If content is genuinely AI-generated, platforms and laws like the EU AI Act may still require you to disclose it.

If you just need clean files, AI Flag Remover does all of the above in the browser (JPG, PNG, WebP, HEIC, AVIF), shows which AI flags it found, and re-checks the output. There's also a free AI image metadata checker if you only want to inspect.

What other metadata quirks have you run into? Let me know in the comments.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @instagram 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-instagram-detect…] indexed:0 read:3min 2026-11-20 · —