-
Notifications
You must be signed in to change notification settings - Fork 10
decode.Function.extractGainmapFromJPEG
github-actions[bot] edited this page Apr 2, 2025
·
17 revisions
@monogrid/gainmap-js / decode / extractGainmapFromJPEG
extractGainmapFromJPEG(
jpegFile):Promise<{gainMap:Uint8Array<ArrayBuffer>;metadata:GainMapMetadata;sdr:Uint8Array<ArrayBuffer>; }>
Defined in: src/decode/extract.ts:25
Extracts XMP Metadata and the gain map recovery image from a single JPEG file.
Uint8Array
an Uint8Array containing and encoded JPEG file
Promise<{ gainMap: Uint8Array<ArrayBuffer>; metadata: GainMapMetadata; sdr: Uint8Array<ArrayBuffer>; }>
an sdr Uint8Array compressed in JPEG, a gainMap Uint8Array compressed in JPEG and the XMP parsed XMP metadata
Error if XMP Metadata is not found
Error if Gain map image is not found
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)