Skip to content

Read and write Exif metadata from/into an image 🏷️

License

Notifications You must be signed in to change notification settings

lodev09/react-native-exify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

React Native Exify

CI NPM Downloads

A simple library to read and write image Exif metadata for your React Native Apps. 🏷️

@lodev09/react-native-exify

Features

  • Read Exif data from an image
  • Write Exif data into an image
  • Tags are typed and standardized
  • Works with Expo and bare React Native projects
  • Supports New Architecture (Turbo Module)

Installation

yarn add @lodev09/react-native-exify

Usage

import * as Exify from '@lodev09/react-native-exify';

Reading Exif 🔍

const uri = 'file://path/to/image.jpg'

const tags = await Exify.read(uri)
console.log(tags)

Important

The uri must include a scheme (e.g. file://, ph://, content://). Bare file paths like /var/mobile/.../image.jpg are not supported and will throw an error.

Note

On Android 10+, GPS data is redacted from content:// URIs by default. The library automatically requests ACCESS_MEDIA_LOCATION at runtime to access unredacted location data. Your app must have media read access (READ_MEDIA_IMAGES or READ_EXTERNAL_STORAGE) granted first. If you're already using a library like expo-media-library that grants ACCESS_MEDIA_LOCATION, exify will use the existing grant.

Writing Exif ✍️

import type { ExifTags } from '@lodev09/react-native-exify';

const uri = 'file://path/to/image.jpg'
const newTags: ExifTags = {
  GPSLatitude: 69.69,
  GPSLongitude: 69.69,
  UserComment: 'Someone wrote GPS here!',
}

const result = await Exify.write(uri, newTags)
console.log(result.tags)

Note

On iOS, writing exif into an Asset file will duplicate the image. iOS does not allow writing exif into an Asset file directly. If you're getting the photo from a camera, write it into the output file first before saving to the Asset library!

Example

See example for more detailed usage.

Built with True Sheet

The example app uses @lodev09/react-native-true-sheet for the image picker UI. Check it out!

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with ❤️ by @lodev09

About

Read and write Exif metadata from/into an image 🏷️

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors 3

  •  
  •  
  •