Loading...
Searching...
No Matches
Image and frame metadata
JPEG XL library (libjxl)
Collaboration diagram for Image and frame metadata:

## Files

file | codestream_header.h
| Definitions of structs and enums for the metadata from the JPEG XL codestream headers (signature, metadata, preview dimensions, ...), excluding color encoding which is in color_encoding.h.
file | compressed_icc.h
| Utility functions to compress and decompress ICC streams.
file | gain_map.h
| Utility functions to manipulate jhgm (gain map) boxes.

## Classes

struct | JxlPreviewHeader
struct | JxlAnimationHeader
struct | JxlBasicInfo
struct | JxlExtraChannelInfo
struct | JxlHeaderExtensions
struct | JxlBlendInfo
struct | JxlLayerInfo
struct | JxlFrameHeader
struct | JxlGainMapBundle

## Enumerations

enum | JxlOrientation { JXL_ORIENT_IDENTITY = 1 , JXL_ORIENT_FLIP_HORIZONTAL = 2 , JXL_ORIENT_ROTATE_180 = 3 , JXL_ORIENT_FLIP_VERTICAL = 4 , JXL_ORIENT_TRANSPOSE = 5 , JXL_ORIENT_ROTATE_90_CW = 6 , JXL_ORIENT_ANTI_TRANSPOSE = 7 , JXL_ORIENT_ROTATE_90_CCW = 8 }

enum

JxlExtraChannelType {
JXL_CHANNEL_ALPHA , JXL_CHANNEL_DEPTH , JXL_CHANNEL_SPOT_COLOR , JXL_CHANNEL_SELECTION_MASK ,
JXL_CHANNEL_BLACK , JXL_CHANNEL_CFA , JXL_CHANNEL_THERMAL , JXL_CHANNEL_RESERVED0 ,
JXL_CHANNEL_RESERVED1 , JXL_CHANNEL_RESERVED2 , JXL_CHANNEL_RESERVED3 , JXL_CHANNEL_RESERVED4 ,
JXL_CHANNEL_RESERVED5 , JXL_CHANNEL_RESERVED6 , JXL_CHANNEL_RESERVED7 , JXL_CHANNEL_UNKNOWN ,
JXL_CHANNEL_OPTIONAL
}

enum | JxlBlendMode { JXL_BLEND_REPLACE = 0 , JXL_BLEND_ADD = 1 , JXL_BLEND_BLEND = 2 , JXL_BLEND_MULADD = 3 , JXL_BLEND_MUL = 4 }

## Functions

JXL_EXPORT JXL_BOOL | JxlICCProfileEncode (const JxlMemoryManager *memory_manager, const uint8_t *icc, size_t icc_size, uint8_t **compressed_icc, size_t *compressed_icc_size)
JXL_EXPORT JXL_BOOL | JxlICCProfileDecode (const JxlMemoryManager *memory_manager, const uint8_t *compressed_icc, size_t compressed_icc_size, uint8_t **icc, size_t *icc_size)
JXL_EXPORT JXL_BOOL | JxlGainMapGetBundleSize (const JxlGainMapBundle *map_bundle, size_t *bundle_size)
JXL_EXPORT JXL_BOOL | JxlGainMapWriteBundle (const JxlGainMapBundle *map_bundle, uint8_t *output_buffer, size_t output_buffer_size, size_t *bytes_written)
JXL_EXPORT JXL_BOOL | JxlGainMapReadBundle (JxlGainMapBundle *map_bundle, const uint8_t *input_buffer, size_t input_buffer_size, size_t *bytes_read)

## Detailed Description

## Enumeration Type Documentation

## JxlBlendMode

enum JxlBlendMode

Frame blend modes. When decoding, if coalescing is enabled (default), this can be ignored.

## JxlExtraChannelType

enum JxlExtraChannelType

Given type of an extra channel.

## JxlOrientation

enum JxlOrientation

Image orientation metadata. Values 1..8 match the EXIF definitions. The name indicates the operation to perform to transform from the encoded image to the display image.

## Function Documentation

## JxlGainMapGetBundleSize()

JXL_EXPORT JXL_BOOL JxlGainMapGetBundleSize | ( | const JxlGainMapBundle * | map_bundle,
|  | size_t * | bundle_size
| ) |  |

Calculates the total size required to serialize the gain map bundle into a binary buffer. This function accounts for all the necessary space to serialize fields such as gain map metadata, color encoding, compressed ICC profile data, and the gain map itself.

Parameters

  [in] | map_bundle | Pointer to the JxlGainMapBundle containing all necessary data to compute the size.
  [out] | bundle_size | The size in bytes required to serialize the bundle.

Returns
  Whether setting the size was successful.

## JxlGainMapReadBundle()

JXL_EXPORT JXL_BOOL JxlGainMapReadBundle | ( | JxlGainMapBundle * | map_bundle,
|  | const uint8_t * | input_buffer,
|  | size_t | input_buffer_size,
|  | size_t * | bytes_read
| ) |  |

Deserializes a gain map bundle from a provided buffer and populates a `JxlGainMapBundle` structure with the data extracted. This function assumes the buffer contains a valid serialized gain map bundle. After successful execution, the `JxlGainMapBundle` structure will reference three different sections within the buffer:

- gain_map_metadata
- alt_icc
- gain_map These sections will be accompanied by their respective sizes. Users must ensure that the buffer remains valid as long as these pointers are in use.
  Parameters

    [in,out] | map_bundle | Pointer to a preallocated `JxlGainMapBundle` where the deserialized data will be stored.
    [in] | input_buffer | Pointer to the buffer containing the serialized gain map bundle data.
    [in] | input_buffer_size | The size of the input buffer in bytes.
    [out] | bytes_read | The number of bytes read from the input buffer.

  Returns
    Whether reading the bundle was successful.

## JxlGainMapWriteBundle()

JXL_EXPORT JXL_BOOL JxlGainMapWriteBundle | ( | const JxlGainMapBundle * | map_bundle,
|  | uint8_t * | output_buffer,
|  | size_t | output_buffer_size,
|  | size_t * | bytes_written
| ) |  |

Serializes the gain map bundle into a preallocated buffer. The function ensures that all parts of the bundle such as metadata, color encoding, compressed ICC profile, and the gain map are correctly encoded into the buffer. First call `JxlGainMapGetBundleSize` to get the size needed for the buffer.

Parameters

  [in] | map_bundle | Pointer to the `JxlGainMapBundle` to serialize.
  [out] | output_buffer | Pointer to the buffer where the serialized data will be written.
  [in] | output_buffer_size | The size of the output buffer in bytes. Must be large enough to hold the entire serialized data.
  [out] | bytes_written | The number of bytes written to the output buffer.

Returns
  Whether writing the bundle was successful.

## JxlICCProfileDecode()

JXL_EXPORT JXL_BOOL JxlICCProfileDecode | ( | const JxlMemoryManager * | memory_manager,
|  | const uint8_t * | compressed_icc,
|  | size_t | compressed_icc_size,
|  | uint8_t ** | icc,
|  | size_t * | icc_size
| ) |  |

Allocates a buffer using the memory manager, fills it with the decompressed version of the ICC profile in `compressed_icc`, returns the result through `output_buffer` and indicates its size through `output_size`.

The result must be freed using the memory manager once it is not of any more use.

Parameters

  [in] | memory_manager | Pointer to a JxlMemoryManager.
  [in] | compressed_icc | Pointer to a buffer containing the compressed ICC profile.
  [in] | compressed_icc_size | Size of the buffer containing the compressed ICC profile.
  [out] | icc | Will be set to a pointer to the buffer containing the result.
  [out] | icc_size | Will be set to the size of the buffer containing the result.

Returns
  Whether decompressing the profile was successful.

## JxlICCProfileEncode()

JXL_EXPORT JXL_BOOL JxlICCProfileEncode | ( | const JxlMemoryManager * | memory_manager,
|  | const uint8_t * | icc,
|  | size_t | icc_size,
|  | uint8_t ** | compressed_icc,
|  | size_t * | compressed_icc_size
| ) |  |

Allocates a buffer using the memory manager, fills it with a compressed representation of an ICC profile, returns the result through `output_buffer` and indicates its size through `output_size`.

The result must be freed using the memory manager once it is not of any more use.

Parameters

  [in] | memory_manager | Pointer to a JxlMemoryManager.
  [in] | icc | Pointer to a buffer containing the uncompressed ICC profile.
  [in] | icc_size | Size of the buffer containing the ICC profile.
  [out] | compressed_icc | Will be set to a pointer to the buffer containing the result.
  [out] | compressed_icc_size | Will be set to the size of the buffer containing the result.

Returns
  Whether compressing the profile was successful.