Integrate encoder

This commit is contained in:
Surma
2020-02-06 15:58:38 -08:00
parent c659018550
commit 30bafab263
8 changed files with 51 additions and 389 deletions

View File

@@ -77,6 +77,15 @@ async function webpDecode(data: ArrayBuffer): Promise<ImageData> {
return decode(data);
}
async function jxlEncode(
data: ImageData, options: import('../jxl/encoder-meta').EncodeOptions,
): Promise<ArrayBuffer> {
const { encode } = await import(
/* webpackChunkName: "process-jxl-enc" */
'../jxl/encoder');
return encode(data, options);
}
async function jxlDecode(data: ArrayBuffer): Promise<ImageData> {
const { decode } = await import(
/* webpackChunkName: "process-jxl-dec" */
@@ -92,6 +101,7 @@ const exports = {
optiPngEncode,
webpEncode,
webpDecode,
jxlEncode,
jxlDecode,
};
export type ProcessorWorkerApi = typeof exports;