Skip to content

libultrahdr.Function.decodeJPEGMetadata

github-actions[bot] edited this page Nov 26, 2024 · 17 revisions

@monogrid/gainmap-js / libultrahdr / decodeJPEGMetadata

Function: decodeJPEGMetadata()

decodeJPEGMetadata(file): Promise<object>

Decodes a JPEG file with an embedded Gainmap and XMP Metadata (aka JPEG-R)

Parameters

file: Uint8Array

A Jpeg file Uint8Array.

Returns

Promise<object>

The decoded data

errorMessage

errorMessage: any

gainMap

gainMap: any

metadata

metadata: string | Uint8ClampedArray | Int8Array | Uint8Array | ArrayBuffer

parsedMetadata

parsedMetadata: GainMapMetadata

Parsed metadata

sdr

sdr: any

success

success: boolean

Deprecated

Example

import { decodeJPEGMetadata } from '@monogrid/gainmap-js/libultrahdr'

// fetch a JPEG image containing a gainmap as ArrayBuffer
const gainmap = new Uint8Array(await (await fetch('gainmap.jpeg')).arrayBuffer())

// extract data from the JPEG
const { gainMap, sdr, parsedMetadata } = await decodeJPEGMetadata(gainmap)

Throws

if the provided file cannot be parsed or does not contain a valid Gainmap

Defined in

src/libultrahdr/decode-jpeg-metadata.ts:54

Clone this wiki locally