Add missing magic number for JPEG XL (#2924)

* Add missing magic number for JPEG XL

* do not force JXL container
This commit is contained in:
Adrià Arrufat 2024-03-06 10:15:10 +09:00 committed by GitHub
parent 9a30c6d48f
commit d45f534d68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 7 deletions

View File

@ -57,11 +57,12 @@ namespace dlib
return DNG;
else if (buffer[0]=='G' && buffer[1]=='I' && buffer[2] == 'F')
return GIF;
else if ((buffer[0] == '\xff' && buffer[1] == '\x0a') ||
memcmp(buffer, jxlHeader, 12) == 0) // we can't use strlen because the header starts with \x00.
return JXL;
else if (buffer[0]=='R' && buffer[1]=='I' && buffer[2] == 'F' && buffer[3] == 'F' &&
buffer[8]=='W' && buffer[9]=='E' && buffer[10] == 'B' && buffer[11] == 'P')
return WEBP;
else if (memcmp(buffer, jxlHeader, 12) == 0) // we can't use strlen because the header starts with \x00.
return JXL;
return UNKNOWN;
}

View File

@ -34,11 +34,6 @@ namespace dlib {
}
auto enc = JxlEncoderMake(nullptr);
if (JXL_ENC_SUCCESS != JxlEncoderUseContainer(enc.get(), JXL_TRUE))
{
throw image_save_error("jxl_saver: JxlEncoderUseContainer failed");
}
auto runner = JxlResizableParallelRunnerMake(nullptr);
JxlResizableParallelRunnerSetThreads(runner.get(), JxlResizableParallelRunnerSuggestThreads(width, height));