@capawesome/capacitor-exif 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +70 -2
  2. package/package.json +12 -3
package/README.md CHANGED
@@ -23,9 +23,14 @@ Capacitor plugin to read, write and remove EXIF metadata from image files.
23
23
 
24
24
  Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!
25
25
 
26
- ## Newsletter
26
+ ## Use Cases
27
27
 
28
- Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
28
+ The Exif plugin is typically used whenever an app needs to work with photo metadata, for example:
29
+
30
+ - **Privacy protection**: Strip GPS positions and other sensitive metadata from photos before uploading them to a server.
31
+ - **Photo organization**: Read the capture date and GPS position to sort and group photos.
32
+ - **Metadata correction**: Fix a wrong capture date or add a missing GPS position without re-encoding the image.
33
+ - **Camera details**: Display camera and lens information such as ISO, aperture, and exposure time in a photo detail view.
29
34
 
30
35
  ## Compatibility
31
36
 
@@ -73,6 +78,12 @@ No configuration required for this plugin.
73
78
 
74
79
  ## Usage
75
80
 
81
+ The following examples show how to read the EXIF metadata of an image, write EXIF tags to an image, and remove the EXIF metadata from an image.
82
+
83
+ ### Read the EXIF metadata of an image
84
+
85
+ Read typed EXIF tags such as the GPS position, camera model, and capture date from an image file. Only available on Android and iOS:
86
+
76
87
  ```typescript
77
88
  import { Exif } from '@capawesome/capacitor-exif';
78
89
 
@@ -82,6 +93,14 @@ const readExif = async () => {
82
93
  });
83
94
  console.log('GPS position:', tags.gpsLatitude, tags.gpsLongitude);
84
95
  };
96
+ ```
97
+
98
+ ### Write EXIF tags to an image
99
+
100
+ Update EXIF tags in place. Only the provided tags are updated and the pixel data is never re-encoded. Only available on Android and iOS:
101
+
102
+ ```typescript
103
+ import { Exif } from '@capawesome/capacitor-exif';
85
104
 
86
105
  const writeExif = async () => {
87
106
  await Exif.writeExif({
@@ -93,6 +112,14 @@ const writeExif = async () => {
93
112
  },
94
113
  });
95
114
  };
115
+ ```
116
+
117
+ ### Remove the EXIF metadata from an image
118
+
119
+ Strip all EXIF metadata from an image file in place, for example to protect the privacy of your users before an upload. By default, the orientation tag is kept so that the image is not suddenly displayed rotated. Only available on Android and iOS:
120
+
121
+ ```typescript
122
+ import { Exif } from '@capawesome/capacitor-exif';
96
123
 
97
124
  const removeExif = async () => {
98
125
  await Exif.removeExif({
@@ -313,6 +340,47 @@ const prepareUpload = async (path: string) => {
313
340
  - HEIC files store the orientation at the container level, so the `orientation` tag can not be changed and is always kept, even with `keepOrientation` set to `false`.
314
341
  - HEIC files may keep the `software` and `dateTimeOriginal` tags after `removeExif(...)`. GPS data and device identity tags (`make`, `model`, `lensModel`) are always removed.
315
342
 
343
+ ## FAQ
344
+
345
+ ### How is this plugin different from other similar plugins?
346
+
347
+ It reads, writes and removes EXIF metadata directly on the image file on Android and iOS, updating tags in place so the pixel data is never re-encoded and the image quality is untouched. It reads and writes HEIC metadata natively, processes files natively without loading them into WebView memory, and uses only official platform APIs, so it stays App Store safe. The API is fully typed, ships for both CocoaPods and Swift Package Manager, and is kept current with the latest Capacitor version.
348
+
349
+ ### Which platforms are supported by this plugin?
350
+
351
+ The plugin supports Android and iOS. All methods (`readExif`, `writeExif` and `removeExif`) are only available on these two platforms, since the files are processed natively and never loaded into the WebView memory.
352
+
353
+ ### Does writing or removing EXIF metadata affect the image quality?
354
+
355
+ No. Writing and removing EXIF metadata is a lossless in-place operation. The pixel data is never decoded or re-encoded, so the image quality is not affected. See [Lossless Metadata Writes](#lossless-metadata-writes) for details on how this is implemented on each platform.
356
+
357
+ ### Which image formats are supported?
358
+
359
+ Reading EXIF metadata works with any image format that the platform supports, including JPEG, PNG, WebP, HEIC/HEIF, and DNG/RAW. Writing and removing metadata is only supported for certain formats, which differ between Android and iOS (see [Format Support](#format-support)). Calling `writeExif(...)` or `removeExif(...)` with an unsupported format rejects with the `UNSUPPORTED_FORMAT` error code.
360
+
361
+ ### Why is the orientation tag still present after calling `removeExif`?
362
+
363
+ The `keepOrientation` option is enabled by default so that images are not suddenly displayed rotated after the metadata has been removed. You can set it to `false` to also remove the orientation tag. Note that HEIC files on iOS store the orientation at the container level, so it is always kept there.
364
+
365
+ ### How do I remove the GPS position from a photo before uploading it?
366
+
367
+ Call `removeExif(...)` with the path to the image file. This strips the GPS position along with all other EXIF metadata in place, without affecting the image quality. See [Privacy: Strip Metadata Before Upload](#privacy-strip-metadata-before-upload) for an example.
368
+
369
+ ### Can I use this plugin with Ionic, React, Vue or Angular?
370
+
371
+ Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.
372
+
373
+ ## Related Plugins
374
+
375
+ - [File Picker](https://capawesome.io/docs/sdks/capacitor/file-picker/): Pick the image files whose metadata you want to read or edit.
376
+ - [File Compressor](https://capawesome.io/docs/sdks/capacitor/file-compressor/): Compress images in formats like PNG, JPEG, and WebP.
377
+ - [Photo Editor](https://capawesome.io/docs/sdks/capacitor/photo-editor/): Let the user edit a photo.
378
+ - [Photo Manipulator](https://capawesome.io/docs/sdks/capacitor/photo-manipulator/): Headless image transforms like crop, resize, rotate, and format conversion.
379
+
380
+ ## Newsletter
381
+
382
+ Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
383
+
316
384
  ## Changelog
317
385
 
318
386
  See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/exif/CHANGELOG.md).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-exif",
3
- "version": "0.0.1",
4
- "description": "Capacitor plugin to read, write and remove EXIF metadata from image files.",
3
+ "version": "0.1.0",
4
+ "description": "Capacitor plugin to read, write and remove EXIF metadata from image files on Android and iOS.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/esm/index.d.ts",
@@ -38,12 +38,21 @@
38
38
  "capacitor",
39
39
  "plugin",
40
40
  "native",
41
+ "capacitor-plugin",
41
42
  "exif",
42
43
  "metadata",
43
44
  "gps",
44
45
  "privacy",
45
46
  "heic",
46
- "jpeg"
47
+ "jpeg",
48
+ "exif metadata",
49
+ "image metadata",
50
+ "photo metadata",
51
+ "exif reader",
52
+ "exif editor",
53
+ "remove exif",
54
+ "strip metadata",
55
+ "geotag"
47
56
  ],
48
57
  "scripts": {
49
58
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",