tf.io.encode_jxl

JPEG XL-encode an image.

image is a rank-N Tensor of type uint8 or uint16 with shape batch_dims + [height, width, channels], where channels is:

  • 1: for grayscale.
  • 3: for RGB.
  • 4: for RGBA.

quality is a JPEG-style quality factor in [0.0, 100.0]. It is mapped internally to a JPEG XL Butteraugli distance using the same mapping as cjxl -q: 100.0 encodes losslessly, 95.0 (the default) is high-quality lossy encoding matching encode_jpeg, 90.0 is visually lossless, and lower values compress more. Quality factors are not comparable across codecs, so a given quality will not produce the same file size or visual quality as the same value passed to tf.io.encode_jpeg.

The effort parameter (1 to 9) controls compression effort (default 7).

image A Tensor. Must be one of the following types: uint8, uint16. Rank N >= 3 with shape batch_dims + [height, width, channels].
quality An optional float. Defaults to 95.0. Quality factor in [0.0, 100.0]; 100.0 encodes losslessly, 95.0 is high-quality lossy, and lower values compress more.
effort An optional int. Defaults to 7. Effort setting from 1 (fastest) to 9 (slowest, best compression).
name A name for the operation (optional).

A Tensor of type string.