Comments (3)
These JPEGs contain two quantization tables but only use one. There is no way in jxl to store a quantization table that is not used, so it is impossible to reconstruct the jpeg bitstreams in this case. That's why JXL_ENC_ERR_JBRD is returned.
This is a limitation of the jpeg bitstream reconstruction specification: jpeg quantization tables are restored based on the corresponding quantization table in the jxl codestream, but in jpeg you can specify a quantization table and then never use it (which is of course just a waste of bytes, and I wonder why any jpeg encoder would ever want to do that), while in jxl you can only specify quantization tables that are actually used.
The jpeg image data itself can be represented just fine when JXL_ENC_ERR_JBRD is returned, it's just impossible to create the jpeg bitstream reconstruction data that will allow you to reconstruct the exact same jpeg file.
One option is to fall back in this case to encoding with JxlEncoderStoreJPEGMetadata set to false. Another option is to 'sanitize' the jpeg with a tool like jpegtran
, which will remove the unused quantization table and create a (smaller) jpeg file that can actually be reconstructed.
From the libjxl point of view, I don't think there's much we can do here...
from libjxl.
Thank you for getting back to me. I hadn't realised that there was an unused table. I'm sure I can figure out a way to strip that out. I'll give jpegtran a try and see how that goes.
from libjxl.
jpegtran does appear to strip out these unused tables just fine, allowing the image to be repackaged using libjxl. Thank you for the help. As libjpeg and jpegtran didn't complain about these files, and they open as usual in an image viewer/web browser, it was hard to identify the issue.
It may be helpful to be a little more verbose/granular in the libjxl errors, if possible, to help identify files such as this. I found JxlEncoderError JXL_ENC_ERR_JBRD a bit too broad to be helpful. Also, I was not sure what is meant by "too much tail data" and a quick web search did not help me here. I think this means extra data appended to the JPEG file after an EOI marker but it would be nice to have this documented somewhere as I had to guess what this means.
EDIT: Maybe just a list and a brief explanation of some common causes of JXL_ENC_ERR_JBRD in the docs would be enough to be very helpful with debugging.
from libjxl.
Related Issues (20)
- unused variable
- No-compressed png encoder fails on Firefox HOT 6
- missing fclose HOT 1
- Failed to build libjxl without `-DJPEGXL_STATIC` on MSVC
- Add flag for controlling ICC HOT 5
- Muxing multiple JPEG into a JXL animation HOT 1
- MSYS2/MinGW, GCC 13.1: undefined references in libjpegli-static.a HOT 3
- Using "already_downsampled" Breaks Patches
- Upsampling mode should apply during normal resampling
- JPEG-XL support in Fiji/ImageJ HOT 2
- Build failure in win32 due to highway regression HOT 2
- ARM build broken (bool / boolean casts) HOT 3
- package v0.8.2 HOT 3
- Inconsistent handling of sBIT values
- cjxl hangs on certain images with --brotli_effort set to 0 or 1 HOT 1
- ApplyLZ77_Optimal: Greatly inflated processing time in combination with -P 0 compared to other predictors
- Fails to compress some 32bits float images with lossless enabled HOT 2
- Optimize an existing jxl image HOT 2
- Meta Adaptive ANS HOT 1
- cjxl[v0.8.2] quality option not work HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libjxl.