Comments (7)
@DejayRezme The problem comes from the fact that for jpeg there is a difference between just storing the pixels losslessly, i.e. distance = 0 and losslessly compressing the bytes of the jpeg file, so that the original jpeg file can be reconstructed. So we need a way to specify a difference between
cjxl -d 0 --lossless_jpeg 1 foo.jpg foo.jxl
and
cjxl -d 0 --lossless_jpeg 0 foo.jpg foo.jxl
(which is probably not what you want)
and
cjxl -d 1 --lossless_jpeg 1 foo.jpg foo.jxl
We tried to make the defaults such that for jpegs lossless recompression of the bytes is the default, because this way no additional artifacts will we introduced, because the operation is reversible.
Do you have concrete suggestions what to change about these defaults?
from libjxl.
Thanks for the report!
This is intended behavior. In case you are compressing a jpg
file, cjxl
will by default attempt to compress it as lossless jpeg re-compression and passing a quality parameter will give the error message you are seeing.
It should encode the image with lossy compression when you pass the --lossless_jpeg=0
flag. The default for this flag is "1", since you didn't pass a value for this flag it will be equivalent to passing --lossless_jpeg=1
.
I think we could make a better job explaining this in cjxl -h
, currently we don't even mention the default setting for this flag
from libjxl.
thanks @mo271 , is --lossless_jpeg
a hidden option, I can't find it when run -h
cjxl -h
JPEG XL encoder v0.8.2 [AVX2,SSE4,SSSE3,SSE2]
Usage: cjxl INPUT OUTPUT [OPTIONS...]
INPUT
the input can be PNG, APNG, GIF, JPEG, EXR, PPM, PFM, or PGX
OUTPUT
the compressed JXL output file
-d maxError, --distance=maxError
Max. butteraugli distance, lower = higher quality.
0.0 = mathematically lossless. Default for already-lossy input (JPEG/GIF).
1.0 = visually lossless. Default for other input.
Recommended range: 0.5 .. 3.0. Allowed range: 0.0 ... 25.0.
Mutually exclusive with --quality.
-q QUALITY, --quality=QUALITY
Quality setting (is remapped to --distance). 100 = mathematically lossless. Default for already-lossy input (JPEG/GIF).
Other input gets encoded as per --distance default,
which corresponds to quality 90.
Quality values roughly match libjpeg quality.
Recommended range: 68 .. 96. Allowed range: 0 .. 100.
Mutually exclusive with --distance.
-e EFFORT, --effort=EFFORT
Encoder effort setting. Range: 1 .. 9.
Default: 7. Higher number is more effort (slower).
--brotli_effort=B_EFFORT
Brotli effort setting. Range: 0 .. 11.
Default: 9. Higher number is more effort (slower).
-p, --progressive
Enable progressive/responsive decoding.
--resampling=-1|1|2|4|8
Resampling for extra channels. Default of -1 applies resampling only for low quality. Value 1 does no downsampling (1x1), 2 does 2x2 downsampling, 4 is for 4x4 downsampling, and 8 for 8x8 downsampling.
-v, --verbose
Verbose output; can be repeated, also applies to help (!).
-h, --help
Prints this help message (use -v to see more options).
from libjxl.
thanks @mo271 , is
--lossless_jpeg
a hidden option, I can't find it when run-h
Yeah, that as well, it will show up only when running cjxl -h -v
( with at least one -v
). Might it make sense to either show this option already without the -v
or put it in the INPUT
section like below? What do you think, @jonsneyers ?
JPEG XL encoder v0.8.2 [AVX2,SSE4,SSSE3,SSE2]
Usage: cjxl INPUT OUTPUT [OPTIONS...]
INPUT
the input can be PNG, APNG, GIF, JPEG, EXR, PPM, PFM, or PGX.
If the input is JPEG, then by default lossless recompression will be applied.
OUTPUT
the compressed JXL output file
from libjxl.
Copy it, thank you so much.
from libjxl.
This broke my ps script for reencoding jpgs.
It seems now every user has to use this more complicated usage and add an if/then/else case into calling cjxl.
I do not see the point as to why - If I specify a distance, it's obvious I do not want lossless. If I specify distance = 0, it's obvious I want lossless. A tool should be as easy and comfortable to use as possible.
Why change the usage suddenly so that other tools or scripts using it break?
from libjxl.
Thanks for the reply @mo271
I would suggest that --lossless_jpeg is ignored if distance isn't 0. That someone needs --distance=0 and --lossless_jpeg=0 seems very rare, since the size should always certainly go up.
Or said differently, the default for --lossless_jpeg is 1 if distance=0,
and --lossless_jpeg is 0 (or ignored) if distance > 0
from libjxl.
Related Issues (20)
- Inquiry Regarding 16-bit RGB Image Compression Using JPEG-XL HOT 9
- check realloc HOT 2
- unused variable HOT 2
- Extreme memory usage during JXL decode (GraphicsMagick oss-fuzz 69728 test case #1) HOT 1
- Extreme memory usage during JXL decode (GraphicsMagick oss-fuzz 69728 test case #2) HOT 1
- Cannot build with docs HOT 3
- Unable to read stdin in PowerShell 5.1 HOT 1
- 13566 trace trap HOT 1
- jxl_from_tree is broken for dimensions > 2048
- Lossy progressive images encoded by cjxl are not actually progressive HOT 1
- Broken scorecard GitHub credentials HOT 1
- Package also for Ubuntu 24.04 HOT 1
- [Request] Please provide better error messages in the cmake-system as to what is missing
- An incorrect MSVC option is applied in a debug build with static linking HOT 6
- Artefacts after encoding lossless animation frames with crop and blending HOT 4
- jxlinfo bin size got much bigger since 0.11.0 HOT 5
- Some warnings that appear when compiling
- Saving 16-bit float lossless image should not fail because losing precision
- No uninstall make target HOT 1
- add guarantees about data_at() ordering for chunked write HOT 1
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.