0.1.1 • Published 2 years ago

exif-wasm v0.1.1

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

exif-wasm

Extracts Exif metadata from images using WebAssembly. Uses the Rust package kamadak-exif internally for parsing and extracting the Exif metadata.

Supported formats:

  • JPEG
  • PNG
  • TIFF
  • WebP
  • HEIF (HEIC and AVIF)

Installation

This package can be installed via:

npm install --save exif-wasm

Usage

import init, { get_exif } from 'exif-wasm';

// Initialize the Exif WebAssembly module
init()
    .then(() => console.debug('Exif WebAssembly module loaded'))
    .catch(error => console.error('Exif WebAssembly module failed to load with error:', error));

// Download the image & extract Exif metadata
fetch('image.jpg')
    .then(res => res.buffer())
    .then(bytes => new Uint8Array(bytes))
    .then(array => get_exif(array))
    .then(console.log);

The output will be in the format:

let exif = {
    success: true,
    error_type: null,
    error_message: null,
    fields: [
        {
            tag: {
                id: 306,
                name: "File change date and time",
                default_value: null
            },
            value: "2022-12-31 12:00:00"
        },
        ...
    ]
}