New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inefficient alpha compression in lossy JXL #2111
Comments
Adding the "-a" option for setting alpha distance is a big improvement. However, RGB+Alpha image is still bigger than RGB and Alpha components encoded as separate images. |
Can you share the input image so I can try to understand what's happening here? |
I think this might be a problem with the combination of e8+ and alpha with Encoding with This doesn't really make sense since the point of not keeping invisible pixels is to compress better. But I'm guessing there is some bug causing e8+ to try to keep the invisible pixels anyway (after they have been turned into a smooth mess by preprocessing), cranking up the adaptive quantization weights to the max. At e7 and lower this should not be an issue. We'll have to fix the behavior at e8+... |
So I suppose the invisible pixel handling was broken from the beginning and separate distance setting for alpha helped to discover that. |
When encoding lossy JXL, distance/quality of alpha channel cannot be adjusted separately and depends on the overall distance/quality setting. This may result in inefficient compression of alpha channel and larger file size.
In the example bellow, there are three JXL files. All of them were cretaed using the recent version of cjxl.
Apparetly the image 3 is notieably larger than images 1 and 2 added together. The reason is the lossless encoding, in this case, compresses the alpha channel much more efficiently than lossy encoding.
My suggested solution is to allow specifying independent distance/quality for alpha channel. Perhaps the default could be set to lossless alpha. Lossless compression is very efficient for alpha consisting mostly of fully transparent and fully opaque areas.
The text was updated successfully, but these errors were encountered: