Skip to content

EXIF Data Encoding And Decoding

Yegor Pelykh edited this page Feb 11, 2023 · 1 revision

EXIF Data Encoding And Decoding Functions

These functions are a simplification of working with the EXIF data of JPG images, without separate encoding, decoding and changing the EXIF data of MemoryImage.

decodeJpgExif

decodeJpgExif(opt: DecodeOptions): ExifData | undefined

Decode only the EXIF data from a JPEG file.

Parameters:

  • data: The contents of the JPEG file of type TypedArray.

Returns the decoded ExifData or undefined if the data cannot be decoded.

injectJpgExif

injectJpgExif(opt: InjectJpgExifOptions): Uint8Array | undefined

Inject ExifData into a JPEG file, replacing any existing EXIF data. The new JPEG file bytes will be returned, otherwise undefined if there was an issue.

Parameters:

  • data: The contents of the JPEG file of type TypedArray.
  • exifData: The EXIF data to inject of type ExifData.

Returns the new JPEG file bytes, otherwise undefined if there was an issue.