Skip to content

decode.Function.extractGainmapFromJPEG

github-actions[bot] edited this page Dec 5, 2024 · 13 revisions

@monogrid/gainmap-js / decode / extractGainmapFromJPEG

Function: extractGainmapFromJPEG()

extractGainmapFromJPEG(jpegFile): Promise<object>

Extracts XMP Metadata and the gain map recovery image from a single JPEG file.

Parameters

jpegFile: Uint8Array

an Uint8Array containing and encoded JPEG file

Returns

Promise<object>

an sdr Uint8Array compressed in JPEG, a gainMap Uint8Array compressed in JPEG and the XMP parsed XMP metadata

gainMap

gainMap: Uint8Array

metadata

metadata: GainMapMetadata

sdr

sdr: Uint8Array

Throws

Error if XMP Metadata is not found

Throws

Error if Gain map image is not found

Example

import { FileLoader } from 'three'
import { extractGainmapFromJPEG } from '@monogrid/gainmap-js'

const jpegFile = await new FileLoader()
 .setResponseType('arraybuffer')
 .loadAsync('image.jpg')

const { sdr, gainMap, metadata } = extractGainmapFromJPEG(jpegFile)

Defined in

src/decode/extract.ts:25

Clone this wiki locally