photo-info
v0.3.4
Published
[![npm version](https://img.shields.io/npm/v/photo-info.svg?style=flat-square)](https://www.npmjs.com/package/photo-info) [![Build](https://github.com/tyom/photo-info/actions/workflows/build.yaml/badge.svg)](https://github.com/tyom/photo-info/actions/work
Downloads
779
Maintainers
Readme
Photo Info
This package provides a function to extract useful information from photos, such as geo location, camera make and model, focal length and angle of view, which could be useful to orient the photo on the map.
Demo App
Try the demo app with a few geotagged photos. All photos operations are done in the browser. No data is sent to any server.
Installation
npm install photo-info
Usage
import { getPhotoInfo } from 'photo-info';
const { angleOfView, bearing, position, make, model } =
await getPhotoInfo(file);
To get the original EXIF data, set the includeOriginalTags
parameter to true
.
const { originalTags, ...photoInfo } = await getPhotoInfo(file, true);
await getPhotoInfo(file);
The getPhotoInfo
function returns an object with the following properties:
make
: the camera makemodel
: the camera modelangleOfView
: the angle of view of the photo in degreesbearing
: the bearing of the photo in degreesgpsPosition
: the position of the photo as a[Latitude, Longitude, Altitude?]
tuplegpsSpeed
: the speed the camera was moving at{ value: number, description: 'km/h' }
focalLength
: the focal length of the camera in millimetersfocalLengthIn35mm
: the focal length of the camera in 35mm equivalent millimeterswidth
: the width of the photo in pixelsheight
: the height of the photo in pixelsorientation
: the orientation of the photo (portrait
,landscape
, orsquare
)frontCamera
: whether the photo was taken with the front cameradateTime
: the date and time the photo was taken in ISO formatexposureTime
: the exposure time of the photo in secondsexposureProgram
: the exposure program setting in the camerafNumber
: the f-number (aperture) of the lenslens
: the lens used to take the photooriginalTags
: the original EXIF tags of the photo (when the second argument ofgetPhotoInfo
is set totrue
)