jpeg_xl.h
| File Path | engine/include/conjure/renderer/jpeg_xl.h |
| API ↗ | Rendering, JPEG XL images |
JPEG XL (ISO/IEC 18181) in the renderer: the signature check the image decoder routes by and an RGBA8 encoder for screenshots and tools. Decoding needs no call of its own: texture_asset::decode, the texture importer (.jxl), glTF images and equirect_image::decode_hdr recognise a JPEG XL file by its signature. libjxl does the work in engine/src; this header carries only engine types.
Structs
| File | Description |
|---|---|
jpeg_xl_encode_options |
How encode_jpeg_xl compresses an image. A lossy encode targets a Butteraugli distance in (0, 25], where 1 is visually lossless. The colour space is what the file is tagged as: sRGB, or linear sRGB for data. |
Functions
Public
encode_jpeg_xl
encode_jpeg_xl[[nodiscard]] CONJURE_API core::result<std::vector<std::byte>> encode_jpeg_xl(
const core::image &image,
const jpeg_xl_encode_options &options = {},
core::jobs::job_system *jobs = nullptr);Encodes an RGBA8 image as a JPEG XL file tagged sRGB or linear sRGB (options.colourSpace), on jobs when it has workers (the bytes are the same either way). A file of an opaque image still stores its alpha channel, so it decodes back to the same RGBA. Fails with INVALID_ARGUMENT for an empty image, an effort outside 1..10 or a lossy distance outside (0, 25], and with BACKEND_FAILURE when libjxl fails.