Comments (4)
Internally, JPEG XL stores grayscale and color images in the same way (grayscale images just happen to have all-zero chroma components). So compression-wise, there is not really anything to gain here.
For the bit-exact reconstruction of the JPEG images, obviously we cannot silently change RGB to Grayscale since that would result in a different reconstructed JPEG file. It also would lead to problems when there's an ICC profile in the JPEG, since you would get a grayscale image with an RGB ICC color profile, which is an invalid combination.
If you know the images are grayscale then as was mentioned above, you may want to use jpegtran
before recompressing the jpeg files, e.g. using something like this:
jpegtran -copy none -optimize -grayscale input.jpg | cjxl - output.jxl
If you're not interested in reconstructing the jpeg file, which would not match the original one anyway, and want to trim of some more bytes, you can add --allow_jpeg_reconstruction=0
to the cjxl command line. The image data will still be the same, but you won't be able to generate a reconstructed jpeg file anymore if you do that.
from libjxl.
Note that you might get a slightly different gamma transfer function for greyscale files in the viewing application. The gamma for greyscale might be set to 2.2 instead of sRGB (sGray). This will result in a slight brightening of the blacks, which might go unnoticed. Some simple programs don't support ICC for greyscale to indicate a gamma. Greyscale uses 1/3-rd of the memory and opens sligthly faster. Even in normal JPEG color compresses down to nothing if absent.
from libjxl.
I'm not sure if this could be implemented in JXL's lossless JPEG transcoding.
You can use a program jpegtran
to remove color information from JPEG images before transcoding to JXL. It will keep the grayscale part intact. It can also remove metadata if you don't need them.
from libjxl.
cjxl will automatically set sRGB transfer fubnction in untagged images, so this should not be an issue.
from libjxl.
Related Issues (20)
- Typos in color_encoding.h HOT 1
- Backslashes in released zip archives paths
- jpegli encoding failed for black png HOT 3
- a2x Syntax Error with .asdf/PyEnv HOT 1
- Trouble compiling on macos (Monterey 12.7.4)
- djpegli: Can't decompress an image HOT 3
- NEON_WITHOUT_AES test fails on armv7l-linux (0.10.2)
- Benchmark-xl producing different output depending on parameters called. SSIMULACRA2 missing when --print_details_csv used.
- JPEG LI drop-in replacement for the system library with the same name
- Failed to build main with skcms in msys2/clang64 HOT 9
- JPEGXL_STATIC fails to build on Fedora 40
- Bundled SSIMULACRA2 detects differences in losslessly converted JXL HOT 1
- DHT marker: no Huffman table found HOT 3
- Just curious why depends on libjpeg, can we use jpegli instead? HOT 1
- Undefined symbols for x86_64: `___cpu_model`
- YCbCr JPEG cannot be losslessly transcoded HOT 1
- Inconsistent default behavior for Jpegli HOT 2
- Unexpected marker 0xd3
- Excessive desaturation of vibrant colors
- deps.sh doesn't download GTest
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.