Comments (2)
Besides what cjpegli should do with this, maybe it is also worth asking the question what cjxl should do.
Physical resolution tags are in my opinion a bit of a mess. PNG has a specific chunk for it, but the information can also be represented using Exif or XMP metadata. Many applications will just ignore the information. Some will use it to scale the image appropriately to obtain those specific physical dimensions. Most just ignore it, i.e. treat it as capture metadata (e.g. put there by a scanner so you know how large the physical image was) like the camera model or GPS coordinates, and not as render-impacting metadata (how the image is supposed to be displayed).
The pHYs tag in PNG can effectively be used for two things that are conceptually quite unrelated imo:
- the (recommended/intended) physical dimensions of the image
- representing pixels with a non-square aspect ratio
This thread: whatwg/html#5574 and some of the threads that are linked in it / linking to it is also relevant in this discussion.
In jxl we have an optional codestream header field to describe intrinsic dimensions (which could be used to represent non-square pixel images) although I think most applications are currently ignoring that field and they should probably be fixed to not ignore it. We don't have a jxl codestream header field to indicate physical dimensions, but we could represent that information in Exif or XMP metadata.
from libjxl.
The use of this metadata is to maintain the size when the image is inserted into a document for printing. Let's say, I have a picture of a compact disc. It will automatically fit the circular template of 12 cm without manual adjustment if the resolution is correct. When I scan a document it may have variable margins. Instead of scaling it to fit, I can set to 100% and centered, and it is the correct size.
When coming from PNG, the value should be rounded so that 599.99... becomes 600.
No application that I know of uses these numbers to scale an image for display. Rectangular pixels are not common in still images. Scaling would lose a great deal of quality too if you went between 96, 72, 83 dpi. Often when people downsample for the monitor, the dpi value stays unchanged, so you have a tiny image at 600 dpi.
My Photoshop takes dpi from 0xFFED (it has decimals) then 0xFFE1/Exif then 0xFFE0/JFIF. XMP is passed along without function; it think most of it is treated as "editing history". The simplest programs read JFIF as it came first. Maybe a simple Exif could be constructed for JPEG-XL if none exist in the input image, and maybe plugins will read after 5 years.
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.