{"slug": "hidden-metadata-in-jpeg-png-and-webp-exif-gps-comfyui-prompts-and-c2pa-markers", "title": "Hidden Metadata in JPEG, PNG, and WebP: EXIF GPS, ComfyUI Prompts, and C2PA Markers Explained (2026)", "summary": "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.", "body_md": "Uploading 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.\n\nWe 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:\n\n`.ZIP` download, and multi-file CSV/JSON audit reports)\nParsing and cleaning containers at the byte level keeps compressed pixel streams intact while discarding only metadata segments and chunks:\n\n| Format | Magic Bytes | Metadata Containers Parsed | Lossless Binary Stripper Behavior | \n|---|---|---|---|\n| **JPEG** | `FF D8` | `APP1` (`Exif\\0\\0` IFDs, XMP XML),`APP2` (multi-chunk`ICC_PROFILE` ),`APP11` (JUMBF/C2PA),`APP13` (`8BIM` IPTC),`COM` | Drops `APP1..APP15` and`COM` while preserving stuffed`FF 00` entropy scans and restart markers; optional`preserveIcc` keeps`APP2` ICC chunks | \n| **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 optional`iCCP` /`sRGB` /`gAMA` ) and recalculates IEEE 802.3`CRC32` (`0xedb88320` ) | \n| **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` (and`ICCP` unless kept), clears`VP8X` flags, keeps RIFF odd-byte padding, and updates`RIFF` size | \n\nEXIF 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).\n\nAI image generators rarely use standard EXIF tags; instead they serialize prompts into PNG text chunks:\n\n`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:`.\n\n``` js\nimport {\n  inspectImageMetadata,\n  stripImageMetadata,\n  auditToMarkdown,\n  auditToCsv,\n} from 'image-metadata-inspector-core';\n\n// 1. Inspect JPEG, PNG, or WebP bytes completely in-memory\nconst audit = inspectImageMetadata(uint8Bytes, 'studio-render.png');\nconsole.log({\n  riskGrade: audit.riskGrade,\n  gps: audit.gps,\n  aiGenerators: audit.aiMetadata.generators,\n  comfyModels: audit.aiMetadata.comfyUi?.models || [],\n  c2paDetected: audit.c2pa.detected,\n});\n\n// 2. Losslessly drop EXIF, GPS, XMP, AI chunks, and C2PA while preserving ICC color profile\nconst cleaned = stripImageMetadata(uint8Bytes, { preserveIcc: true });\n\n// 3. Export pipe-escaped Markdown or formula-safe RFC 4180 CSV\nconst mdReport = auditToMarkdown([audit]);\nconst csvReport = auditToCsv([audit]);\n```\n\nYou can also run audits or clean directories from the terminal using the bundled zero-dependency CLI:\n\n```\nnpx image-metadata-inspector inspect photo.jpg render.png --json\nnpx image-metadata-inspector strip photo.jpg photo.clean.jpg\nnpx image-metadata-inspector strip render.png render.strict.png --drop-icc\n```\n\nRewriting binary images safely requires three strict checks:\n\n`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).\nFinally, 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.\n\n`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.", "url": "https://wpnews.pro/news/hidden-metadata-in-jpeg-png-and-webp-exif-gps-comfyui-prompts-and-c2pa-markers", "canonical_source": "https://dev.to/apps66/hidden-metadata-in-jpeg-png-and-webp-exif-gps-comfyui-prompts-and-c2pa-markers-explained-2026-43nf", "published_at": "2026-12-06 13:08:50+00:00", "updated_at": "2026-12-06 13:14:12.125025+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "generative-ai", "structured-data"], "entities": ["ComfyUI", "NovelAI", "Midjourney", "C2PA", "Automatic1111"], "also_reported_by": [], "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.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/hidden-metadata-in-jpeg-png-and-webp-exif-gps-comfyui-prompts-and-c2pa-markers", "markdown": "https://wpnews.pro/news/hidden-metadata-in-jpeg-png-and-webp-exif-gps-comfyui-prompts-and-c2pa-markers.md", "text": "https://wpnews.pro/news/hidden-metadata-in-jpeg-png-and-webp-exif-gps-comfyui-prompts-and-c2pa-markers.txt", "jsonld": "https://wpnews.pro/news/hidden-metadata-in-jpeg-png-and-webp-exif-gps-comfyui-prompts-and-c2pa-markers.jsonld"}}