-
Notifications
You must be signed in to change notification settings - Fork 9
libultrahdr.Function.decodeJPEGMetadata
github-actions[bot] edited this page Dec 5, 2024
·
17 revisions
@monogrid/gainmap-js / libultrahdr / decodeJPEGMetadata
decodeJPEGMetadata(
file
):Promise
<object
>
Decodes a JPEG file with an embedded Gainmap and XMP Metadata (aka JPEG-R)
• file: Uint8Array
A Jpeg file Uint8Array.
Promise
<object
>
The decoded data
errorMessage:
any
gainMap:
any
metadata:
string
|Uint8ClampedArray
|Int8Array
|Uint8Array
|ArrayBuffer
parsedMetadata:
GainMapMetadata
sdr:
any
success:
boolean
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)
if the provided file cannot be parsed or does not contain a valid Gainmap