Giter VIP home page Giter VIP logo

Comments (2)

jonsneyers avatar jonsneyers commented on June 3, 2024

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.

j7nj7n avatar j7nj7n commented on June 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.