21 lines
715 B
C++
21 lines
715 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace fgc {
|
|
|
|
// Thin wrapper around libjxl for encoding an 8-bit interleaved image buffer
|
|
// to a JPEG XL file. Replaces the header-only JPEG_XL.h class.
|
|
class JpegXlEncoder {
|
|
public:
|
|
// Encode `img` (width*height*channels bytes, 8-bit, 1 or 3 channels) to
|
|
// `path`. `distance` is the JPEG XL frame distance (0 = lossless, higher =
|
|
// lossier); `effort` is the libjxl effort level. Returns true on success.
|
|
static bool encodeToFile(const std::string& path, const uint8_t* img, int width,
|
|
int height, int channels, float distance, int effort,
|
|
int threads = 3);
|
|
};
|
|
|
|
} // namespace fgc
|