5

I'm using ImagePicker from Expo to import an image from the camera roll. I then want to display select exif and metadata from the image along with the photo. That works OK:

  const pickImage = async () => {
let result = await ImagePicker.launchImageLibraryAsync({
  mediaTypes: ImagePicker.MediaTypeOptions.All,
  allowsEditing: true,
  aspect: [4, 3],
  quality: 1,
  exif: true,
});
console.log(result.exif);

The output I get is:

    Object {
      "ApertureValue": 6,
      "BodySerialNumber": "1234********",
      "ColorSpace": 65535,
      "CustomRendered": 0,
      "DateTimeDigitized": "2021:01:21 16:23:06",
      "DateTimeOriginal": "2021:01:21 16:23:06",
      "ExifVersion": Array [
        2,
        3,
        1,
      ],
      "ExposureBiasValue": 0,
      "ExposureMode": 1,
      "ExposureProgram": 1,
      "ExposureTime": 0.005,
      "FNumber": 8,
      "Flash": 16,
      "FocalLength": 34,
      "FocalPlaneResolutionUnit": 3,
      "FocalPlaneXResolution": 1866.6666564941406,
      "FocalPlaneYResolution": 1866.6666564941406,
      "ISOSpeedRatings": Array [
        800,
      ],
      "LensModel": "EF16-35mm f/2.8L USM",
      "LensSerialNumber": "0000000000",
      "LensSpecification": Array [
        16,
        35,
        0,
        0,
      ],
      "MaxApertureValue": 3,
      "MeteringMode": 5,
      "Orientation": 1,
      "PixelXDimension": 1000,
      "PixelYDimension": 667,
      "RecommendedExposureIndex": 800,
      "SceneCaptureType": 0,
      "SensitivityType": 2,
      "ShutterSpeedValue": 7.643856,
      "SubsecTime": "28",
      "SubsecTimeDigitized": "28",
      "SubsecTimeOriginal": "28",
      "WhiteBalance": 1,
    }

While the actual exif descriptions are different from the same image viewed in Photoshop>File>File Info, that's not a major problem.

The issue is that there is all sorts of metadata that is not exif that I want to access. For example, while I can get the type of lens used, I cant get the type of camera used without this metadata:

    <tiff:Model>Canon EOS 5D Mark IV</tiff:Model>

which is not exif, it's tiff metadata.

Other metadata I would like to access are things like the camera owners name (if they have provided that info) and the approximate focus distance. Or (while there are privacy issues in some cases) optional inclusion of gps location data.

All this is in the image metadata, just not exif.

How to I access ALL metadata in an image, or at least tiff as well as exif, in an Expo managed react native project?

Kelvin Aitken
  • 433
  • 6
  • 18

0 Answers0