Giter VIP home page Giter VIP logo

Comments (4)

jonsneyers avatar jonsneyers commented on June 3, 2024 1

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.

j7nj7n avatar j7nj7n commented on June 3, 2024 1

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.

jendalinda avatar jendalinda commented on June 3, 2024

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.

jendalinda avatar jendalinda commented on June 3, 2024

cjxl will automatically set sRGB transfer fubnction in untagged images, so this should not be an issue.

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.