LibGd 2.4.0-dev
GD Graphics library
Loading...
Searching...
No Matches
Data Structures
JPEG XL

JPEG XL image reading, writing, and animation support. More...

Collaboration diagram for JPEG XL:

Data Structures

struct  gdJxlWriteOptions
 JPEG XL still-image writer options. More...
 
struct  gdJxlInfo
 JPEG XL top-level file information. More...
 
struct  gdJxlFrameInfo
 JPEG XL raw frame information. More...
 
struct  gdJxlReadOptions
 JPEG XL multi-image/animation reader options. More...
 
struct  gdJxlAnimWriteOptions
 JPEG XL animation writer options. More...
 

JPEG XL File Information And Animation Types

enum  {
  gdJxlBlendReplace , gdJxlBlendAdd , gdJxlBlendBlend , gdJxlBlendMuladd ,
  gdJxlBlendMul
}
 JPEG XL raw frame blend modes. More...
 
typedef struct gdJxlRead * gdJxlReadPtr
 Opaque JPEG XL multi-image/animation reader handle.
 
typedef struct gdJxlWrite * gdJxlWritePtr
 Opaque JPEG XL multi-image/animation writer handle.
 
void gdJxlReadOptionsInit (gdJxlReadOptions *options)
 Initialize JPEG XL multi-image/animation read options with gd defaults.
 
void gdJxlAnimWriteOptionsInit (gdJxlAnimWriteOptions *options)
 Initialize JPEG XL multi-image/animation write options with gd defaults.
 

JPEG XL Single-Image Reading

gdImagePtr gdImageCreateFromJxl (FILE *inFile)
 Create a truecolor image from a JPEG XL stdio file.
 
gdImagePtr gdImageCreateFromJxlPtr (int size, void *data)
 Create a truecolor image from a JPEG XL memory buffer.
 
gdImagePtr gdImageCreateFromJxlCtx (gdIOCtxPtr infile)
 Create a truecolor image from JPEG XL data read through a gdIOCtx.
 

JPEG XL Single-Image Writing

void gdImageJxl (gdImagePtr im, FILE *outFile)
 Write an image as JPEG XL data to a stdio file.
 
void gdImageJxlEx (gdImagePtr im, FILE *outFile, int lossless, float distance, int effort)
 Write an image as JPEG XL data to a stdio file with encoder settings.
 
void * gdImageJxlPtr (gdImagePtr im, int *size)
 Write an image as JPEG XL data to a newly allocated memory buffer.
 
void * gdImageJxlPtrEx (gdImagePtr im, int *size, int lossless, float distance, int effort)
 Write an image as JPEG XL data to a newly allocated memory buffer with encoder settings.
 
void gdImageJxlCtx (gdImagePtr im, gdIOCtxPtr outfile)
 Write an image as JPEG XL data to a gdIOCtx.
 
void gdImageJxlCtxEx (gdImagePtr im, gdIOCtxPtr outfile, int lossless, float distance, int effort)
 Write an image as JPEG XL data to a gdIOCtx with encoder settings.
 
void gdJxlWriteOptionsInit (gdJxlWriteOptions *options)
 Initialize JPEG XL still-image write options with gd defaults.
 
int gdImageJxlWithOptions (gdImagePtr im, FILE *outFile, const gdJxlWriteOptions *options)
 Write an image as JPEG XL data to a stdio file with write options.
 
int gdImageJxlCtxWithOptions (gdImagePtr im, gdIOCtxPtr outfile, const gdJxlWriteOptions *options)
 Write an image as JPEG XL data to a gdIOCtx with write options.
 
void * gdImageJxlPtrWithOptions (gdImagePtr im, int *size, const gdJxlWriteOptions *options)
 Write an image as JPEG XL data to a newly allocated memory buffer with write options.
 

JPEG XL Multi-Image/Animation Reading

gdJxlReadPtr gdJxlReadOpen (FILE *inFile, const gdJxlReadOptions *options)
 Open a JPEG XL multi-image/animation reader from a stdio file.
 
gdJxlReadPtr gdJxlReadOpenCtx (gdIOCtxPtr inCtx, const gdJxlReadOptions *options)
 Open a JPEG XL multi-image/animation reader from a gdIOCtx.
 
gdJxlReadPtr gdJxlReadOpenPtr (int size, void *data, const gdJxlReadOptions *options)
 Open a JPEG XL multi-image/animation reader from a memory buffer.
 
int gdJxlReadGetInfo (gdJxlReadPtr reader, gdJxlInfo *info)
 Get JPEG XL image or animation information from a reader.
 
int gdJxlReadGetMetadata (gdJxlReadPtr reader, gdImageMetadata *metadata)
 Extract supported still-image metadata from a JPEG XL reader.
 
int gdJxlReadNextImage (gdJxlReadPtr reader, int *delay_ms, gdImagePtr *image)
 Read the next coalesced JPEG XL image.
 
int gdJxlReadNextFrame (gdJxlReadPtr reader, gdJxlFrameInfo *info, gdImagePtr *frame)
 Read the next raw JPEG XL frame rectangle.
 
void gdJxlReadClose (gdJxlReadPtr reader)
 Close a JPEG XL multi-image reader.
 

JPEG XL Multi-Image/Animation Writing

gdJxlWritePtr gdJxlWriteOpen (FILE *outFile, const gdJxlAnimWriteOptions *options)
 Open a JPEG XL multi-image/animation writer for a stdio file.
 
gdJxlWritePtr gdJxlWriteOpenCtx (gdIOCtxPtr outCtx, const gdJxlAnimWriteOptions *options)
 Open a JPEG XL multi-image/animation writer for a gdIOCtx.
 
gdJxlWritePtr gdJxlWriteOpenPtr (const gdJxlAnimWriteOptions *options)
 Open a JPEG XL multi-image/animation writer that returns a memory buffer.
 
int gdJxlWriteAddImage (gdJxlWritePtr writer, gdImagePtr image, int delay_ms)
 Add a full-canvas image to a JPEG XL multi-image/animation writer.
 
void gdJxlWriteClose (gdJxlWritePtr writer)
 Add a full-canvas image to a JPEG XL multi-image/animation writer.
 
void * gdJxlWritePtrFinish (gdJxlWritePtr writer, int *size)
 Finish a JPEG XL multi-image/animation memory writer and return the encoded buffer.
 

Detailed Description

JPEG XL image reading, writing, and animation support.

JPEG XL support reads still images as truecolor gd images and writes still images with either lossy distance settings or lossless encoding. Animation readers can return coalesced full-canvas images or raw frame rectangles, and animation writers accept full-canvas truecolor frames.

gdImagePtr first, second, image;
gdJxlAnimWriteOptions write_options;
gdJxlReadPtr reader;
void *data;
int size, delay_ms, result;
first = gdImageCreateTrueColor(32, 24);
second = gdImageCreateTrueColor(32, 24);
if (first == NULL || second == NULL) {
exit(1);
}
gdImageFilledRectangle(first, 0, 0, 31, 23, gdTrueColor(255, 0, 0));
gdImageFilledRectangle(second, 0, 0, 31, 23, gdTrueColor(0, 0, 255));
gdJxlAnimWriteOptionsInit(&write_options);
write_options.lossless = 1;
write_options.loopCount = 0;
writer = gdJxlWriteOpenPtr(&write_options);
if (writer == NULL) {
gdImageDestroy(first);
gdImageDestroy(second);
exit(1);
}
gdJxlWriteAddImage(writer, first, 120);
gdJxlWriteAddImage(writer, second, 80);
data = gdJxlWritePtrFinish(writer, &size);
reader = gdJxlReadOpenPtr(size, data, NULL);
while ((result = gdJxlReadNextImage(reader, &delay_ms, &image)) == 1) {
gdImageDestroy(image);
}
gdFree(data);
gdImageDestroy(first);
gdImageDestroy(second);
void gdImageFilledRectangle(gdImagePtr im, int x1, int y1, int x2, int y2, int color)
Draws a filled rectangle.
Definition gd.c:2403
void gdJxlReadClose(gdJxlReadPtr reader)
Close a JPEG XL multi-image reader.
Definition gd_jxl.c:1894
gdJxlReadPtr gdJxlReadOpenPtr(int size, void *data, const gdJxlReadOptions *options)
Open a JPEG XL multi-image/animation reader from a memory buffer.
Definition gd_jxl.c:1853
struct gdJxlRead * gdJxlReadPtr
Opaque JPEG XL multi-image/animation reader handle.
Definition gd.h:2764
void * gdJxlWritePtrFinish(gdJxlWritePtr writer, int *size)
Finish a JPEG XL multi-image/animation memory writer and return the encoded buffer.
Definition gd_jxl.c:1938
void gdJxlAnimWriteOptionsInit(gdJxlAnimWriteOptions *options)
Initialize JPEG XL multi-image/animation write options with gd defaults.
Definition gd_jxl.c:1709
gdJxlWritePtr gdJxlWriteOpenPtr(const gdJxlAnimWriteOptions *options)
Open a JPEG XL multi-image/animation writer that returns a memory buffer.
Definition gd_jxl.c:1916
int gdJxlWriteAddImage(gdJxlWritePtr writer, gdImagePtr image, int delay_ms)
Add a full-canvas image to a JPEG XL multi-image/animation writer.
Definition gd_jxl.c:1923
struct gdJxlWrite * gdJxlWritePtr
Opaque JPEG XL multi-image/animation writer handle.
Definition gd.h:2773
int gdJxlReadNextImage(gdJxlReadPtr reader, int *delay_ms, gdImagePtr *image)
Read the next coalesced JPEG XL image.
Definition gd_jxl.c:1871
JPEG XL animation writer options.
Definition gd.h:2822
int lossless
Definition gd.h:2825

Typedef Documentation

◆ gdJxlReadPtr

typedef struct gdJxlRead* gdJxlReadPtr

Opaque JPEG XL multi-image/animation reader handle.

Handles returned by gdJxlReadOpen, gdJxlReadOpenCtx(), or gdJxlReadOpenPtr must be closed with gdJxlReadClose.

◆ gdJxlWritePtr

typedef struct gdJxlWrite* gdJxlWritePtr

Opaque JPEG XL multi-image/animation writer handle.

Handles returned by gdJxlWriteOpen or gdJxlWriteOpenCtx must be closed with gdJxlWriteClose. Handles returned by gdJxlWriteOpenPtr must be finished with gdJxlWritePtrFinish.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

JPEG XL raw frame blend modes.

Enumerator
gdJxlBlendReplace 

Replace the frame rectangle with the new frame.

gdJxlBlendAdd 

Add the new frame to the existing canvas.

gdJxlBlendBlend 

Blend the new frame over the existing canvas.

gdJxlBlendMuladd 

Multiply then add the new frame with the existing canvas.

gdJxlBlendMul 

Multiply the new frame with the existing canvas.

Function Documentation

◆ gdImageCreateFromJxl()

gdImagePtr gdImageCreateFromJxl ( FILE *  inFile)

Create a truecolor image from a JPEG XL stdio file.

gdImageCreateFromJxl() does not close inFile. The returned image is caller-owned and must be destroyed with gdImageDestroy.

Parameters
inFilePointer to the input FILE stream.
Returns
Returns a gdImagePtr on success, or NULL on failure.

◆ gdImageCreateFromJxlCtx()

gdImagePtr gdImageCreateFromJxlCtx ( gdIOCtxPtr  infile)

Create a truecolor image from JPEG XL data read through a gdIOCtx.

gdImageCreateFromJxlCtx() does not close infile. The returned image is caller-owned and must be destroyed with gdImageDestroy.

Parameters
infilePointer to the gdIOCtx input context.
Returns
Returns a gdImagePtr on success, or NULL on failure.

◆ gdImageCreateFromJxlPtr()

gdImagePtr gdImageCreateFromJxlPtr ( int  size,
void *  data 
)

Create a truecolor image from a JPEG XL memory buffer.

The data buffer is borrowed for the duration of the call. The returned image is caller-owned and must be destroyed with gdImageDestroy.

Parameters
sizeSize of the JPEG XL memory buffer in bytes.
dataPointer to the JPEG XL memory buffer.
Returns
Returns a gdImagePtr on success, or NULL on failure.

◆ gdImageJxl()

void gdImageJxl ( gdImagePtr  im,
FILE *  outFile 
)

Write an image as JPEG XL data to a stdio file.

gdImageJxl() does not close outFile. The image is borrowed for the duration of the call; palette images may be converted to truecolor internally.

Parameters
imThe image to write.
outFilePointer to the output FILE stream.

◆ gdImageJxlCtx()

void gdImageJxlCtx ( gdImagePtr  im,
gdIOCtxPtr  outfile 
)

Write an image as JPEG XL data to a gdIOCtx.

gdImageJxlCtx() does not close outfile. The image is borrowed for the duration of the call; palette images may be converted to truecolor internally.

Parameters
imThe image to write.
outfilePointer to the gdIOCtx output context.

◆ gdImageJxlCtxEx()

void gdImageJxlCtxEx ( gdImagePtr  im,
gdIOCtxPtr  outfile,
int  lossless,
float  distance,
int  effort 
)

Write an image as JPEG XL data to a gdIOCtx with encoder settings.

gdImageJxlCtxEx() does not close outfile. The image is borrowed for the duration of the call; palette images may be converted to truecolor internally.

Parameters
imThe image to write.
outfilePointer to the gdIOCtx output context.
losslessNon-zero to use lossless JPEG XL encoding.
distanceLossy encoding distance when lossless is zero.
effortEncoder effort setting.

◆ gdImageJxlCtxWithOptions()

int gdImageJxlCtxWithOptions ( gdImagePtr  im,
gdIOCtxPtr  outfile,
const gdJxlWriteOptions options 
)

Write an image as JPEG XL data to a gdIOCtx with write options.

Parameters
imThe image to write.
outfilePointer to the gdIOCtx output context.
optionsPointer to the JPEG XL write options.
Returns
Returns non-zero on success, or zero on failure.

◆ gdImageJxlEx()

void gdImageJxlEx ( gdImagePtr  im,
FILE *  outFile,
int  lossless,
float  distance,
int  effort 
)

Write an image as JPEG XL data to a stdio file with encoder settings.

gdImageJxlEx() does not close outFile. The image is borrowed for the duration of the call; palette images may be converted to truecolor internally.

Parameters
imThe image to write.
outFilePointer to the output FILE stream.
losslessNon-zero to use lossless JPEG XL encoding.
distanceLossy encoding distance when lossless is zero.
effortEncoder effort setting.

◆ gdImageJxlPtr()

void * gdImageJxlPtr ( gdImagePtr  im,
int *  size 
)

Write an image as JPEG XL data to a newly allocated memory buffer.

The image is borrowed for the duration of the call; palette images may be converted to truecolor internally. The returned buffer is caller-owned and must be freed with gdFree().

Parameters
imThe image to write.
sizePointer to an integer that receives the returned buffer size.
Returns
Returns a pointer to the newly allocated JPEG XL buffer, or NULL on failure.

◆ gdImageJxlPtrEx()

void * gdImageJxlPtrEx ( gdImagePtr  im,
int *  size,
int  lossless,
float  distance,
int  effort 
)

Write an image as JPEG XL data to a newly allocated memory buffer with encoder settings.

The image is borrowed for the duration of the call; palette images may be converted to truecolor internally. The returned buffer is caller-owned and must be freed with gdFree().

Parameters
imThe image to write.
sizePointer to an integer that receives the returned buffer size.
losslessNon-zero to use lossless JPEG XL encoding.
distanceLossy encoding distance when lossless is zero.
effortEncoder effort setting.
Returns
Returns a pointer to the newly allocated JPEG XL buffer, or NULL on failure.

◆ gdImageJxlPtrWithOptions()

void * gdImageJxlPtrWithOptions ( gdImagePtr  im,
int *  size,
const gdJxlWriteOptions options 
)

Write an image as JPEG XL data to a newly allocated memory buffer with write options.

The image is borrowed for the duration of the call; palette images may be converted to truecolor internally. The returned buffer is caller-owned and must be freed with gdFree().

Parameters
imThe image to write.
sizePointer to an integer that receives the returned buffer size.
optionsPointer to the JPEG XL write options.
Returns
Returns a pointer to the newly allocated memory buffer, or NULL on failure.

◆ gdImageJxlWithOptions()

int gdImageJxlWithOptions ( gdImagePtr  im,
FILE *  outFile,
const gdJxlWriteOptions options 
)

Write an image as JPEG XL data to a stdio file with write options.

Parameters
imThe image to write.
outFilePointer to the output FILE stream.
optionsPointer to the JPEG XL write options.
Returns
Returns non-zero on success, or zero on failure.

◆ gdJxlAnimWriteOptionsInit()

void gdJxlAnimWriteOptionsInit ( gdJxlAnimWriteOptions options)

Initialize JPEG XL multi-image/animation write options with gd defaults.

The default writer infers the canvas size from the first frame, writes lossy JPEG XL with distance 1.0 and effort 7, and uses loopCount 0 for infinite looping.

Parameters
optionsPointer to the write options structure to initialize.

◆ gdJxlReadClose()

void gdJxlReadClose ( gdJxlReadPtr  reader)

Close a JPEG XL multi-image reader.

Parameters
readerJPEG XL reader handle to close, or NULL.

◆ gdJxlReadGetInfo()

int gdJxlReadGetInfo ( gdJxlReadPtr  reader,
gdJxlInfo info 
)

Get JPEG XL image or animation information from a reader.

The returned gdJxlInfo describes the canvas size and animation loop count reported by the JPEG XL stream.

Parameters
readerJPEG XL reader handle.
infoPointer to a gdJxlInfo structure to receive image information.
Returns
Returns 1 on success, or 0 on failure.

◆ gdJxlReadGetMetadata()

int gdJxlReadGetMetadata ( gdJxlReadPtr  reader,
gdImageMetadata *  metadata 
)

Extract supported still-image metadata from a JPEG XL reader.

The caller owns the metadata object. Animation metadata is not exposed.

◆ gdJxlReadNextFrame()

int gdJxlReadNextFrame ( gdJxlReadPtr  reader,
gdJxlFrameInfo info,
gdImagePtr *  frame 
)

Read the next raw JPEG XL frame rectangle.

This function is used with non-coalesced readers. When frame is not NULL and the function returns 1, *frame receives a caller-owned truecolor frame rectangle that must be destroyed with gdImageDestroy. Passing NULL for frame advances the reader without returning the decoded image.

Parameters
readerJPEG XL reader handle opened with raw-frame mode.
infoPointer to receive raw frame information.
framePointer to receive the caller-owned frame image, or NULL.
Returns
Returns 1 when a frame is read, 0 at end of stream, or -1 on error.

◆ gdJxlReadNextImage()

int gdJxlReadNextImage ( gdJxlReadPtr  reader,
int *  delay_ms,
gdImagePtr *  image 
)

Read the next coalesced JPEG XL image.

This function is used with coalesced readers. When image is not NULL and the function returns 1, *image receives a caller-owned full-canvas truecolor image that must be destroyed with gdImageDestroy. Passing NULL for image advances the reader without returning the decoded image.

Parameters
readerJPEG XL reader handle opened with coalesced mode.
delay_msPointer to receive the frame duration in milliseconds, or NULL.
imagePointer to receive the caller-owned image, or NULL.
Returns
Returns 1 when an image is read, 0 at end of stream, or -1 on error.

◆ gdJxlReadOpen()

gdJxlReadPtr gdJxlReadOpen ( FILE *  inFile,
const gdJxlReadOptions options 
)

Open a JPEG XL multi-image/animation reader from a stdio file.

gdJxlReadOpen() reads the JPEG XL data into the reader and does not close inFile. Pass NULL for options to use gd defaults. The returned handle must be closed with gdJxlReadClose().

Parameters
inFilePointer to the input FILE stream.
optionsPointer to read options, or NULL for defaults.
Returns
Returns a JPEG XL reader handle on success, or NULL on failure.

◆ gdJxlReadOpenCtx()

gdJxlReadPtr gdJxlReadOpenCtx ( gdIOCtxPtr  inCtx,
const gdJxlReadOptions options 
)

Open a JPEG XL multi-image/animation reader from a gdIOCtx.

gdJxlReadOpenCtx() reads the JPEG XL data into the reader and does not close inCtx. Pass NULL for options to use gd defaults. The returned handle must be closed with gdJxlReadClose().

Parameters
inCtxPointer to the gdIOCtx input context.
optionsPointer to read options, or NULL for defaults.
Returns
Returns a JPEG XL reader handle on success, or NULL on failure.

◆ gdJxlReadOpenPtr()

gdJxlReadPtr gdJxlReadOpenPtr ( int  size,
void *  data,
const gdJxlReadOptions options 
)

Open a JPEG XL multi-image/animation reader from a memory buffer.

The data buffer is borrowed for the duration of the call. Pass NULL for options to use gd defaults. The returned handle owns its copy of the JPEG XL data and must be closed with gdJxlReadClose.

Parameters
sizeSize of the JPEG XL memory buffer in bytes.
dataPointer to the JPEG XL memory buffer.
optionsPointer to read options, or NULL for defaults.
Returns
Returns a JPEG XL reader handle on success, or NULL on failure.

◆ gdJxlReadOptionsInit()

void gdJxlReadOptionsInit ( gdJxlReadOptions options)

Initialize JPEG XL multi-image/animation read options with gd defaults.

The default reader mode is coalesced, so gdJxlReadNextImage returns full-canvas rendered images. Set gdJxlReadOptions::coalesced to zero before opening the reader to read raw frame rectangles with gdJxlReadNextFrame.

Parameters
optionsPointer to the read options structure to initialize.

◆ gdJxlWriteAddImage()

int gdJxlWriteAddImage ( gdJxlWritePtr  writer,
gdImagePtr  image,
int  delay_ms 
)

Add a full-canvas image to a JPEG XL multi-image/animation writer.

The image is borrowed for the duration of the call and remains owned by the caller. The image must be truecolor. All images must match the resolved canvas size; when the writer canvas is zero, the first image sets it.

Parameters
writerJPEG XL writer handle.
imageImage to add as the next frame.
delay_msFrame duration in milliseconds.
Returns
Returns 1 on success, or 0 on failure.

◆ gdJxlWriteClose()

void gdJxlWriteClose ( gdJxlWritePtr  writer)

Add a full-canvas image to a JPEG XL multi-image/animation writer.

Use this for handles returned by gdJxlWriteOpen() or gdJxlWriteOpenCtx(). For memory writers returned by gdJxlWriteOpenPtr, use gdJxlWritePtrFinish.

Parameters
writerJPEG XL writer handle to finish and close, or NULL.

◆ gdJxlWriteOpen()

gdJxlWritePtr gdJxlWriteOpen ( FILE *  outFile,
const gdJxlAnimWriteOptions options 
)

Open a JPEG XL multi-image/animation writer for a stdio file.

gdJxlWriteOpen does not close outFile. Pass NULL for options to use gd defaults. The returned handle must be closed with gdJxlWriteClose.

Parameters
outFilePointer to the output FILE stream.
optionsPointer to write options, or NULL for defaults.
Returns
Returns a JPEG XL writer handle on success, or NULL on failure.

◆ gdJxlWriteOpenCtx()

gdJxlWritePtr gdJxlWriteOpenCtx ( gdIOCtxPtr  outCtx,
const gdJxlAnimWriteOptions options 
)

Open a JPEG XL multi-image/animation writer for a gdIOCtx.

The output context is borrowed and is not closed by gdJxlWriteClose. Pass NULL for options to use gd defaults. The returned handle must be closed with gdJxlWriteClose.

Parameters
outCtxPointer to the gdIOCtx output context.
optionsPointer to write options, or NULL for defaults.
Returns
Returns a JPEG XL writer handle on success, or NULL on failure.

◆ gdJxlWriteOpenPtr()

gdJxlWritePtr gdJxlWriteOpenPtr ( const gdJxlAnimWriteOptions options)

Open a JPEG XL multi-image/animation writer that returns a memory buffer.

Pass NULL for options to use gd defaults. The returned handle must be finished with gdJxlWritePtrFinish.

Parameters
optionsPointer to write options, or NULL for defaults.
Returns
Returns a JPEG XL memory writer handle on success, or NULL on failure.

◆ gdJxlWriteOptionsInit()

void gdJxlWriteOptionsInit ( gdJxlWriteOptions options)

Initialize JPEG XL still-image write options with gd defaults.

Parameters
optionsPointer to the write options structure to initialize.

◆ gdJxlWritePtrFinish()

void * gdJxlWritePtrFinish ( gdJxlWritePtr  writer,
int *  size 
)

Finish a JPEG XL multi-image/animation memory writer and return the encoded buffer.

This closes writer whether encoding succeeds or fails. The returned buffer is caller-owned and must be freed with gdFree().

Parameters
writerJPEG XL memory writer handle returned by gdJxlWriteOpenPtr.
sizePointer to an integer that receives the returned buffer size.
Returns
Returns a pointer to the newly allocated JPEG XL buffer, or NULL on failure.