-
Notifications
You must be signed in to change notification settings - Fork 6
decode.Function.extractGainmapFromJPEG
github-actions[bot] edited this page Dec 5, 2024
·
13 revisions
@monogrid/gainmap-js / decode / extractGainmapFromJPEG
extractGainmapFromJPEG(
jpegFile
):Promise
<object
>
Extracts XMP Metadata and the gain map recovery image from a single JPEG file.
• jpegFile: Uint8Array
an Uint8Array
containing and encoded JPEG file
Promise
<object
>
an sdr Uint8Array
compressed in JPEG, a gainMap Uint8Array
compressed in JPEG and the XMP parsed XMP metadata
gainMap:
Uint8Array
metadata:
GainMapMetadata
sdr:
Uint8Array
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)