{"id":13825674,"url":"https://github.com/terkelg/exifer","last_synced_at":"2025-04-05T17:03:42.022Z","repository":{"id":57112413,"uuid":"204791186","full_name":"terkelg/exifer","owner":"terkelg","description":"A lightweight Exif meta-data decipher.","archived":false,"fork":false,"pushed_at":"2020-01-08T14:43:26.000Z","size":43758,"stargazers_count":314,"open_issues_count":1,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T16:03:58.155Z","etag":null,"topics":["browser","exif","exif-data","exif-metadata","metadata","nodejs","parser","photos"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/terkelg.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}},"created_at":"2019-08-27T21:10:58.000Z","updated_at":"2025-02-24T11:34:30.000Z","dependencies_parsed_at":"2022-08-21T10:31:14.602Z","dependency_job_id":null,"html_url":"https://github.com/terkelg/exifer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fexifer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fexifer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fexifer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fexifer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terkelg","download_url":"https://codeload.github.com/terkelg/exifer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369953,"owners_count":20927928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["browser","exif","exif-data","exif-metadata","metadata","nodejs","parser","photos"],"created_at":"2024-08-04T09:01:25.157Z","updated_at":"2025-04-05T17:03:41.982Z","avatar_url":"https://github.com/terkelg.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/terkelg/exifer/raw/master/exifer.png\" alt=\"exifer\" width=\"200\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://npmjs.org/package/exifer\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/npm/v/exifer\" alt=\"version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/terkelg/exifer/actions\"\u003e\n    \u003cimg src=\"https://github.com/terkelg/exifer/workflows/Integration/badge.svg\" alt=\"integration status\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/terkelg/exifer\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/codecov/c/github/terkelg/exifer\" alt=\"codecov\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://unpkg.com/exifer\"\u003e\n    \u003cimg src=\"http://img.badgesize.io/https://unpkg.com/exifer/dist/exifer.mjs?compression=gzip\" alt=\"gzip size\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eA lightweight exif image meta-data decipher\u003c/b\u003e\u003cbr\u003e\n  Exifer is a small module that read JPEG/TIFF meta-data.\n\u003c/p\u003e\n\nExif tags/fields are used to encode additional information into images taken by digital still cameras. The exif meta information is organized into different Image File Directories (IFD's) within the image. It contains useful information like image rotation, GPS coordinates, times stamps. ISO, etc.\n\n\n## Features\n\n- 📦 **Lightweight**: Small with zero Dependencies\n- 🔍 **Extract** Exif, GPS, XMP and IPTC\n- 📷 **Files**: Support both JPEG, DNG and TIFF files\n- 📚 **Add-ons**: Extra tags and parsers [available](#add-ons)\n- ♻️ **Isomorphic**: Works in node.js and the browser\n\nThis module exposes three module definitions:\n\n* **ES Module**: `dist/exifer.mjs`\n* **UMD**: `dist/exifer.umd.js`\n* **CommonJS**: `dist/exifer.js`\n\n## Install\n\n```\n$ npm install exifer\n```\n\nThe script can also be directly included from [unpkg.com](https://unpkg.com):\n```html\n\u003cscript src=\"https://unpkg.com/exifer\"\u003e\u003c/script\u003e\n```\n\n\n## Usage\n\n```js\nimport exifer from 'exifer';\nimport fs from 'fs';\n\nconst buffer = fs.readFileSync('photo.jpg');\nconst tags = await exifer(buffer);\n// {\n//   Make: 'Apple',\n//   Model: 'iPhone X',\n//   Orientation: 6,\n//   Software: '12.4',\n//   ModifyDate: '2019:08:25 15:07:02',\n//   ... and so on\n// }\n```\n\n\u003e **OBS**: Exifer only reads a few tags by default. You can add [your own](#optstags) or use [add-on modules](#add-ons) to read and parse additional tags.\n\n\n## API\n\n### exifer(input, [opts])\nReturns: `object` \u003c_Promise_\u003e\n\nTakes a JPEG, DNG or JIFF image as input and returns an object with extracted meta-data. A `Promise` is returned that resolves to an hash-map of tag/value pairs.\n\nExifer only reads the most essential tags out of the box – which should cover 99% of all use cases.\n\nTo read or parse more tags chekcout [`opts.tags`](#optstags).\n\n\n#### input\nType: `Buffer|ArrayBuffer|File`\n\nExample running in the browser reading a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) ([`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)):\n\n```js\nimport exifer from 'exifer';\n\n/**\n * Assume 'input' is the value coming from an input field:\n * \u003cinput type=\"file\" accept=\"image/*\" id=\"input\" \u003e\n */\n\nconst input = document.getElementById('#input').files[0];\nconst tags = await exifer(input);\n```\n\nExample running in node.js reading a JPEG [`Buffer`](https://nodejs.org/api/buffer.html):\n\n```js\nimport exifer from 'exifer';\nimport fs from 'fs';\n\nconst buffer = fs.readFileSync('photo.jpg');\nconst tags = await exifer(buffer);\n```\n\nIt's recomended to only feed Exifer some of the image buffer when dealing with very large files. The first 500kb should be enough in most cases:\n\n```js\nimport exifer from 'exifer';\nimport fs from 'fs';\n\nconst full = fs.readFileSync('photo.jpg');\nconst slice = full.buffer.slice(0, 0.5 * 1024 * 1024);\nconst tags = await exifer(slice);\n```\n\n\n#### opts.tags\nType: `object`\u003cbr\u003e\n\nExifer does not extract more than the most essential tags.\n\nYou can extract additional tags, or overwrite the [default tags](packages/exifer/src/tags.js), if you want to read more tags than what's provided by default or wamt custom parsers. You can do this by passing [`tag objects`](#tag) to either `tags.exif`, `tags.gps` and/or `tags.iptc`.\n\nThe key for additional IFD image tags is the IFD field code in hexadecimal notation. The value is a [tag object](#tag) with at least a `name` property.\n\nHere's an example where Exifer is instructed to read two additional gps tags. They are passed as [tag objects](#tags) to `tags.gps`:\n\n```js\nimport exifer from 'exifer';\nimport fs from 'fs';\n\n// try to read more GPS tags and parse timestamp\nconst gps = {\n  0x0001: {name: 'GPSLatitudeRef'},\n  0x0007: {name: 'GPSTimeStamp', parse: x =\u003e {\n    return new Date(Date.UTC(1970, 0, 1, x[0], x[1], x[2]));\n  }}\n}\n\nconst buffer = fs.readFileSync('photo.jpg');\nconst parsed = await exifer(buffer, {tags: { gps }});\n// {\n//    ...\n//    GPSLatitudeRef: 'N',\n//    GPSTimeStamp: 1970-01-01T19:06:58.000Z\n//    ...\n// }\n```\n\n\n##### opts.tags.exif\nType: `object`\u003cbr\u003e\ndefault: `{}`\n\nHash-map with additonal exif tags.\n\n\u003e **OBS:** Find list of exif tags [here](https://exiftool.org/TagNames/EXIF.html)\n\n\n##### opts.tags.iptc\nType: `object`\u003cbr\u003e\ndefault: `{}`\n\nHash-map with additonal IPTC tags.\n\n\u003e **OBS:** Find list of IPTC tags [here](https://exiftool.org/TagNames/IPTC.html)\n\n\n##### opts.tags.gps\nType: `object`\u003cbr\u003e\ndefault: `{}`\n\nHash-map with additonal GPS tags.\n\n\u003e **OBS:** Find list of exif tags [here](https://exiftool.org/TagNames/GPS.html)\n\n\n##### Add-ons\n\nIf you want to read all tags the following exifer add-on packages have you covered:\n\n- **[@exifer/exif](packages/exif)**: Read and parse all Exif tags\n- **[@exifer/gps](packages/gps)**: Read and parse all GPS tags\n- **[@exifer/iptc](packages/iptc)**: Read and parse all IPTC tags\n\nTo read and parse all exif and tiff tags using add-ons, you simply import and pass them to the corresponding tags option:\n\n```js\nimport exifer from 'exifer';\nimport iptc from '@exifer/iptc';\nimport exif from '@exifer/exif';\nimport fs from 'fs';\n\nconst buffer = fs.readFileSync('photo.jpg');\nconst parsed = await exifer(buffer, {tags: { exif, iptc }});\n```\n\n\n#### options.skipexif\nType: `boolean`\u003cbr\u003e\nDefault: `false`\n\nSkip exif tags.\n\n\n#### options.skipiptc\nType: `boolean`\u003cbr\u003e\nDefault: `false`\n\nSkip IPTC tags.\n\n\n#### options.skipxmp\nType: `boolean`\u003cbr\u003e\nDefault: `false`\n\nSkip XMP tags.\n\n\n\n### Tag\nType: `Object`\n\nExifer only comes with a [few built-in tags](packages/exifer/src/tags.js). None of the default [tag objects](#tag) have parsers associated with them.\n\nExample with a rather useless parser:\n```js\n{name: 'ModifyDate', raw: false, parse: x =\u003e `date is ${x}`}\n```\n\n#### tag.name\nType: `String`\u003cbr\u003e\n\nRequired tag name. This is used as the key in the returned result object from [exifer](packages/exifer).\n\n\u003e**OBS:** name is the only required porperty.\n\n\n#### tag.raw\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nBy default all tags are interpreted as ASCII strings.\nSet `raw` to `true` to get the raw tag value.\n\n\n#### tag.parse\nType: `Function`\u003cbr\u003e\n\nCustom parser function. Use this to transform tag values.\nInput is a ASCII string unless `raw` is `true`.\n\nThe returned output is used in the final result object returned by [exifer](packages/exifer).\n\n\n## Credit\n\nInspired by [exif-orientation](https://github.com/ginpei/exif-orientation) and [ExifReader](https://github.com/mattiasw/ExifReader).\n\n## License\n\nMIT © [Terkel Gjervig](https://terkel.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterkelg%2Fexifer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterkelg%2Fexifer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterkelg%2Fexifer/lists"}