{"id":50372444,"url":"https://github.com/kkhys/scrub-exif","last_synced_at":"2026-05-30T08:00:40.786Z","repository":{"id":361331940,"uuid":"1254059793","full_name":"kkhys/scrub-exif","owner":"kkhys","description":"Losslessly strip Exif/GPS and all other metadata from JPEG \u0026 PNG. Zero-dependency, no native binary, runs anywhere.","archived":false,"fork":false,"pushed_at":"2026-05-30T06:19:31.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-30T07:14:56.386Z","etag":null,"topics":["cli","exif","gps","jpeg","lossless","metadata","nodejs","png","privacy","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/scrub-exif","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kkhys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-30T05:12:26.000Z","updated_at":"2026-05-30T06:19:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kkhys/scrub-exif","commit_stats":null,"previous_names":["kkhys/scrub-exif"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kkhys/scrub-exif","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkhys%2Fscrub-exif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkhys%2Fscrub-exif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkhys%2Fscrub-exif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkhys%2Fscrub-exif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kkhys","download_url":"https://codeload.github.com/kkhys/scrub-exif/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkhys%2Fscrub-exif/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33684413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","exif","gps","jpeg","lossless","metadata","nodejs","png","privacy","typescript"],"created_at":"2026-05-30T08:00:35.125Z","updated_at":"2026-05-30T08:00:40.769Z","avatar_url":"https://github.com/kkhys.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scrub-exif\n\n[![npm version](https://img.shields.io/npm/v/scrub-exif.svg)](https://www.npmjs.com/package/scrub-exif)\n[![CI](https://github.com/kkhys/scrub-exif/actions/workflows/ci.yml/badge.svg)](https://github.com/kkhys/scrub-exif/actions/workflows/ci.yml)\n[![license](https://img.shields.io/npm/l/scrub-exif.svg)](./LICENSE)\n\nLosslessly strip Exif/GPS and all other metadata from JPEG and PNG files, keeping only the color profile.\n\n- **Lossless** — pixel data is never re-encoded. Only metadata segments/chunks are removed; every remaining byte (including color profiles) is preserved.\n- **Zero dependencies** — nothing is installed alongside it.\n- **No native binaries** — pure TypeScript/JavaScript. No `exiftool`, no `sharp`, no platform builds. Runs anywhere Node does (and in Bun/Deno).\n\n## Why\n\nPhotos carry hidden metadata — most importantly **GPS coordinates** that can reveal your home address. Common tools have trade-offs:\n\n| Tool | Strips metadata | Lossless | No native binary |\n| --- | --- | --- | --- |\n| `exiftool` | ✅ everything | ✅ | ❌ (Perl binary) |\n| `sharp` | ✅ on re-encode | ❌ recompresses | ❌ (native) |\n| **scrub-exif** | ✅ all but ICC profile | ✅ | ✅ |\n\n`scrub-exif` removes every metadata block — Exif/GPS, XMP, IPTC, vendor and\ncomment segments — while keeping the ICC color profile and leaving the\ncompressed image data byte-for-byte intact.\n\n## Install\n\n```sh\nnpm install scrub-exif\n# or run without installing:\nnpx scrub-exif \u003cfiles|dirs...\u003e\n```\n\n## CLI\n\n```sh\nscrub-exif photo.jpg                # strip a single file in place\nscrub-exif ./images                 # recurse a directory (.jpg/.jpeg/.png)\nscrub-exif ./images --dry-run       # show what would be removed, write nothing\nscrub-exif . --check                # exit 1 if any file still has metadata\nscrub-exif ./images --quiet         # only print changed files + summary\n```\n\n`--check` makes a great CI gate or pre-commit hook: it never writes and fails\nwhen metadata is still present.\n\n```\n[strip] images/beach.jpg removed=[APP1, APP13] (-29953 bytes)\n[clean] images/logo.png\n[skip ] images/notes.txt\n\n1/3 files stripped (-29953 bytes).\n```\n\n## Use as a pre-commit hook (lefthook)\n\nStrip metadata automatically every time images are committed. Install\n`scrub-exif` as a dev dependency and add a command to your\n[lefthook](https://lefthook.dev) config:\n\n```yaml\n# lefthook.yml\npre-commit:\n  commands:\n    scrub-exif:\n      glob: \"*.{jpg,jpeg,png,JPG,JPEG,PNG}\"\n      run: npx scrub-exif {staged_files}\n      stage_fixed: true\n```\n\n`stage_fixed: true` re-stages the cleaned files, so the commit always lands\nwithout metadata. `{staged_files}` passes only the staged images matching the\nglob, keeping the hook fast.\n\n\u003e With pnpm/Yarn you can swap `npx` for `pnpm exec` / `yarn`. The hook activates\n\u003e after `lefthook install` runs (e.g. via a `prepare` script on install).\n\n## Programmatic API\n\n```ts\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { stripExif } from \"scrub-exif\";\n\nconst input = new Uint8Array(await readFile(\"photo.jpg\"));\nconst result = stripExif(input);\n\nresult.format; // \"jpeg\" | \"png\" | \"unknown\"\nresult.removed; // e.g. [\"APP1\", \"APP13\"]\nresult.changed; // true if any metadata was removed\n\nif (result.changed) {\n  await writeFile(\"photo.jpg\", result.data);\n}\n```\n\nLower-level, format-specific functions are also exported:\n\n```ts\nimport { stripJpeg, stripPng, isJpeg, isPng, detectFormat } from \"scrub-exif\";\n```\n\n## What gets removed\n\n| Format | Removed | Kept |\n| --- | --- | --- |\n| JPEG | `APP1` (Exif/GPS, XMP), `APP13` (IPTC/Photoshop), every other `APPn` vendor segment, `COM` (comments) | `APP0` (JFIF), `APP2` (ICC profile), `APP14` (Adobe), and all image data |\n| PNG | `eXIf`, `tEXt`, `zTXt`, `iTXt` (XMP), `tIME` | `IHDR`, `PLTE`, `iCCP`, `sRGB`, `gAMA`, `cHRM`, `pHYs`, `IDAT`, `IEND`, … |\n\nUnknown formats are returned unchanged.\n\n## License\n\nMIT © kkhys\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkhys%2Fscrub-exif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkkhys%2Fscrub-exif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkhys%2Fscrub-exif/lists"}