cd /news/developer-tools/hidden-metadata-in-jpeg-png-and-webp… · home › topics › developer-tools › article
[ARTICLE · art-182878] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

Hidden Metadata in JPEG, PNG, and WebP: EXIF GPS, ComfyUI Prompts, and C2PA Markers Explained (2026)

A developer built a browser-local image metadata inspector and lossless binary stripper in pure ESM JavaScript that parses JPEG, PNG, and WebP container bytes directly in memory with zero network uploads. The tool walks EXIF TIFF IFDs to surface GPS coordinates and camera serial numbers, extracts ComfyUI, Automatic1111, NovelAI, and Midjourney prompt metadata from PNG text chunks, and detects C2PA/JUMBF markers, while the stripper drops metadata segments and chunks without recompressing pixel data. It also exports pipe-escaped Markdown and formula-safe CSV audit reports.

key takeaway

Parsing and stripping metadata at the container byte level (JPEG APP segments, PNG chunks, WebP RIFF chunks) removes EXIF/GPS, AI prompt chunks and C2PA markers without recompressing pixels, preserving ICC profiles and animated frames.

by read4 min views6 publishedDec 6, 2026

Up a private photo or unreleased AI asset to a remote server just to check whether it leaks GPS coordinates defeats the point of privacy hygiene. Traditional server-side metadata tools commonly retain uploads for 24 to 72 hours while running backend binaries. On the other hand, scrubbing EXIF tags by drawing onto an HTML5 <canvas> introduces JPEG recompression artifacts, alters PNG compression, drops wide-gamut ICC profiles, or flattens animated WebP frames.

We built a 100% browser-local image metadata inspector and lossless binary stripper in pure ESM JavaScript that operates directly on Uint8Array container bytes with zero network uploads:

.ZIP download, and multi-file CSV/JSON audit reports) Parsing and cleaning containers at the byte level keeps compressed pixel streams intact while discarding only metadata segments and chunks:

Format Magic Bytes Metadata Containers Parsed Lossless Binary Stripper Behavior
JPEG FF D8 APP1 (Exif\0\0 IFDs, XMP XML),APP2 (multi-chunkICC_PROFILE ),APP11 (JUMBF/C2PA),APP13 (8BIM IPTC),COM Drops APP1..APP15 andCOM while preserving stuffedFF 00 entropy scans and restart markers; optionalpreserveIcc keepsAPP2 ICC chunks
PNG 89 50 4E 47 0D 0A 1A 0A tEXt ,zTXt (zlib),iTXt (UTF-8 / zlib),eXIf ,iCCP ,pHYs ,tIME ,caBX (C2PA JUMBF) Keeps strictly IHDR ,PLTE ,tRNS ,IDAT ,IEND (plus optionaliCCP /sRGB /gAMA ) and recalculates IEEE 802.3CRC32 (0xedb88320 )
WebP RIFF....WEBP VP8X bitmasks (0x40 ICC,0x20 Alpha,0x10 EXIF,0x08 XMP,0x04 ANIM),EXIF ,XMP ,ICCP ,C2PA ,JUMB Drops EXIF ,XMP ,C2PA ,JUMB (andICCP unless kept), clearsVP8X flags, keeps RIFF odd-byte padding, and updatesRIFF size

EXIF uses identical TIFF IFD layouts across JPEG APP1, PNG eXIf, and WebP EXIF. Checking the II (0x4949) or MM (0x4d4d) byte-order marker and walking IFD0, ExifIFD (0x8769), and GPS IFD (0x8825) with cycle protection surfaces camera serial numbers ( BodySerialNumber, LensSerialNumber), UserComment text, and rational DMS GPS coordinates (degrees + minutes / 60 + seconds / 3600, negated for S/ W refs and below-sea-level altitude).

AI image generators rarely use standard EXIF tags; instead they serialize prompts into PNG text chunks:

zTXt chunks and compressed iTXt chunks (compFlag === 1) use RFC 1950/1951 Deflate streams. To stay dependency-free across browser and Node runtimes, the library embeds a synchronous inflateZlib() decoder handling stored blocks, fixed Huffman tables, and dynamic Huffman trees with a 16 MB guard.prompt & workflow): class_type to collect model/LoRA/VAE filenames (ckpt_name, unet_name, model_name, lora_name, vae_name), KSampler parameters (seed, steps, cfg, sampler_name, scheduler), CLIP prompt strings, and graph node/link counts. parameters (and EXIF UserComment) on Negative prompt: and Steps:, extracts NovelAI Software + JSON Comment metadata, and catches Midjourney Description flags (--ar, --v) plus Job ID:.

import {
  inspectImageMetadata,
  stripImageMetadata,
  auditToMarkdown,
  auditToCsv,
} from 'image-metadata-inspector-core';

// 1. Inspect JPEG, PNG, or WebP bytes completely in-memory
const audit = inspectImageMetadata(uint8Bytes, 'studio-render.png');
console.log({
  riskGrade: audit.riskGrade,
  gps: audit.gps,
  aiGenerators: audit.aiMetadata.generators,
  comfyModels: audit.aiMetadata.comfyUi?.models || [],
  c2paDetected: audit.c2pa.detected,
});

// 2. Losslessly drop EXIF, GPS, XMP, AI chunks, and C2PA while preserving ICC color profile
const cleaned = stripImageMetadata(uint8Bytes, { preserveIcc: true });

// 3. Export pipe-escaped Markdown or formula-safe RFC 4180 CSV
const mdReport = auditToMarkdown([audit]);
const csvReport = auditToCsv([audit]);

You can also run audits or clean directories from the terminal using the bundled zero-dependency CLI:

npx image-metadata-inspector inspect photo.jpg render.png --json
npx image-metadata-inspector strip photo.jpg photo.clean.jpg
npx image-metadata-inspector strip render.png render.strict.png --drop-icc

Rewriting binary images safely requires three strict checks:

SOS (0xDA), findEntropyScanEnd() advances across byte-stuffed FF 00 pairs and restart markers (FF D0..FF D7) so progressive multi-scan JPEGs survive intact while trailing post-EOI bytes are stripped.IHDR, PLTE, tRNS, IDAT, IEND, plus optional color chunks) and recalculating each chunk's 4-byte CRC32 over [type + data]. EXIF or XMP must clear bits 0x10 and 0x08 in VP8X (collapsing ICC, Alpha, or Animation flags remain). Finally, metadata fields inside third-party files are untrusted strings. Opening unescaped dc:creator values or filenames like =HYPERLINK(...) in Excel risks CSV formula injection. auditToCsv() neutralizes any value starting with =, +, -, @, \t, or \r (including after leading whitespace) with a leading single quote before RFC 4180 quoting.

gradePrivacyRisk() flags GPS coordinates, creator/device serial PII, ComfyUI/SD prompt leaks, and C2PA markers as HIGH, camera/software/timestamps as MEDIUM, and clean containers (including ICC-only images) as CLEAN. Client-side processing ensures sensitive coordinates never touch remote infrastructure.APP11, caBX, WebP C2PA/ JUMB, and XMP detects JUMBF containers and claim hints ( c2pa.claim, trainedAlgorithmicMedia), not X.509/COSE trust signature verification.

── more in #developer-tools 4 stories · sorted by recency
── more on @comfyui 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/hidden-metadata-in-j…] indexed:0 read:4min 2026-12-06 · —