Skip to content

JXL->JXL processing (to remove alpha channel) drops color profile #8022

@ferdnyc

Description

@ferdnyc

ImageMagick version

7.1.1-44

Operating system

Linux

Operating system, version and so on

Fedora 41 x86_64

Description

The Fedora 42 background images are going to be distributed in JXL format instead of the traditional PNG. Due to the limitations of the GNOME background system's timed-transition image blending, it's necessary that background images be stripped of their alpha channel before installation. We've been accomplishing that with a magick -alpha off command, which works fine on PNG images.

It works fairly well on JXL images as well (with an added -quality 100), but the output image no longer carries the same color profile as the input image.

Steps to Reproduce

1. Unzip and examine the original file:

$ unzip f42-01-day.zip
Archive:  f42-01-day.zip
  inflating: f42-01-day.jxl          

$ identify -verbose f42-01-day.jxl
Image:
  Filename: f42-01-day.jxl
  Permissions: rw-r--r--
  Format: JXL (JPEG XL (ISO/IEC 18181))
  Mime type: image/jxl
  Class: DirectClass
  Geometry: 4032x3024+0+0
  Units: Undefined
  Colorspace: sRGB
  Type: TrueColorAlpha
  Base type: Undefined
  Endianness: Undefined
  Depth: 8-bit
  Channels: 4.0
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
    Alpha: 1-bit
  Channel statistics:
    Pixels: 12192768
    Red:
      min: 12  (0.0470588)
      max: 214 (0.839216)
      mean: 126.731 (0.496982)
      median: 133 (0.521569)
      standard deviation: 43.3644 (0.170056)
      kurtosis: -0.324868
      skewness: 0.0404497
      entropy: 0.749915
    Green:
      min: 5  (0.0196078)
      max: 224 (0.878431)
      mean: 137.296 (0.538416)
      median: 142 (0.556863)
      standard deviation: 47.5222 (0.186362)
      kurtosis: -0.608794
      skewness: -0.11526
      entropy: 0.76154
    Blue:
      min: 5  (0.0196078)
      max: 221 (0.866667)
      mean: 105.595 (0.414096)
      median: 90 (0.352941)
      standard deviation: 54.5139 (0.21378)
      kurtosis: -0.439243
      skewness: 0.766023
      entropy: 0.752578
    Alpha:
      min: 255  (1)
      max: 255 (1)
      mean: 255 (1)
      median: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
      entropy: 0
  Image statistics:
    Overall:
      min: 5  (0.0196078)
      max: 255 (1)
      mean: 156.155 (0.612374)
      median: 155 (0.607843)
      standard deviation: 36.3501 (0.14255)
      kurtosis: -0.343226
      skewness: 0.172803
      entropy: 0.566008
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33,0.03)
    green primary: (0.3,0.6,0.1)
    blue primary: (0.15,0.06,0.79)
    white point: (0.3127,0.329,0.3583)
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 4032x3024+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: TopLeft
  Profiles:
    Profile-icc: 9080 bytes
  Properties:
    date:create: 2025-03-11T23:48:07+00:00
    date:modify: 2025-03-11T08:05:06+00:00
    date:timestamp: 2025-03-11T23:48:55+00:00
    icc:copyright: Copyright 2015, Elle Stone (website: http://ninedegreesbelow.com/; email: [email protected]). This ICC profile is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License (https://creativecommons.org/licenses/by-sa/3.0/legalcode).
    icc:description: sRGB-elle-V2-srgbtrc.icc
    mime:type: image/jxl
    signature: 6a090391cc3d126be6a5807503aeef4cfddce0c527120cbf76252cdaa7e4ddbd
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 1.93684MiB
  Number pixels: 12.1928M
  Pixel cache type: Memory
  Pixels per second: 13.1612MP
  User time: 2.440u
  Elapsed time: 0:01.926
  Version: ImageMagick 7.1.1-44 Q16-HDRI x86_64 22688 https://imagemagick.org

The original image contains a 9k color profile, sRGB-elle-V2-srgbtrc.icc.

2. Process the image using ImageMagick to remove alpha channel

$ magick f42-01-day.jxl -quality 100 -alpha off f42-01-day_noalpha.jxl

3. Examine the output file

$ identify -verbose f42-01-day_noalpha.jxl
Image:
  Filename: f42-01-day_noalpha.jxl
  Permissions: rw-r--r--
  Format: JXL (JPEG XL (ISO/IEC 18181))
  Mime type: image/jxl
  Class: DirectClass
  Geometry: 4032x3024+0+0
  Units: Undefined
  Colorspace: sRGB
  Type: TrueColor
  Base type: Undefined
  Endianness: Undefined
  Depth: 8-bit
  Channels: 3.0
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
  Channel statistics:
    Pixels: 12192768
    Red:
      min: 12  (0.0470588)
      max: 214 (0.839216)
      mean: 126.731 (0.496982)
      median: 133 (0.521569)
      standard deviation: 43.3644 (0.170056)
      kurtosis: -0.324868
      skewness: 0.0404497
      entropy: 0.749915
    Green:
      min: 5  (0.0196078)
      max: 224 (0.878431)
      mean: 137.296 (0.538416)
      median: 142 (0.556863)
      standard deviation: 47.5222 (0.186362)
      kurtosis: -0.608794
      skewness: -0.11526
      entropy: 0.76154
    Blue:
      min: 5  (0.0196078)
      max: 221 (0.866667)
      mean: 105.595 (0.414096)
      median: 90 (0.352941)
      standard deviation: 54.5139 (0.21378)
      kurtosis: -0.439243
      skewness: 0.766023
      entropy: 0.752578
  Image statistics:
    Overall:
      min: 5  (0.0196078)
      max: 224 (0.878431)
      mean: 123.207 (0.483165)
      median: 121.667 (0.477124)
      standard deviation: 48.4668 (0.190066)
      kurtosis: -0.457635
      skewness: 0.230404
      entropy: 0.754678
  Rendering intent: Relative
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33,0.03)
    green primary: (0.3,0.6,0.1)
    blue primary: (0.15,0.06,0.79)
    white point: (0.3127,0.329,0.3583)
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 4032x3024+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: TopLeft
  Profiles:
    Profile-icc: 536 bytes
  Properties:
    date:create: 2025-03-11T23:50:54+00:00
    date:modify: 2025-03-11T23:50:54+00:00
    date:timestamp: 2025-03-11T23:51:34+00:00
    icc:copyright: CC0
    icc:description: RGB_D65_SRG_Rel_SRG
    mime:type: image/jxl
    signature: bb19320a637ffbb342d9fcf381ea825659dbf8c10ac02fd768311252f2a68c33
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 1.9296MiB
  Number pixels: 12.1928M
  Pixel cache type: Memory
  Pixels per second: 14.5702MP
  User time: 2.270u
  Elapsed time: 0:01.836
  Version: ImageMagick 7.1.1-44 Q16-HDRI x86_64 22688 https://imagemagick.org

The image no longer has an alpha channel (that's good!), but has lost the ICC profile and other metadata.

Delegate information:

$ magick -list format|grep jxl
      JXL* JXL       rw+   JPEG XL (ISO/IEC 18181) (libjxl 0.10.4)

Images

Here's the first of the upcoming Fedora 42 background images, in source JXL format (with color profile):

f42-01-day.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions