updating from image v0.24 to image v0.25 is causing colour distortions
Hello !
I don't have the time to investigate more deeply on this, but I wanted to let you know. Updating from image-rs v0.24 to v0.25 causes serious color distortions in decoded jpeg images.
This can be reproduced by compiling dezoomify-rs against the two different versions of image-rs.
I fixed the issue in dezoomify-rs by downgrading image-rs, but I thought this may be worth sharing here.
The detailed reproduction steps are here: https://github.com/lovasoa/dezoomify-rs/issues/259#issuecomment-2373567635
My best guess is that image tiles like these are not decoded properly: tiles.zip
Interesting, and may be relevant: the gnome file browser image previews are also decoded with incorrect colors, but the gnome image viewer gets the right colors (same as image-rs v0.24):
The problem may come from the embedded color profile in the image (Prophoto RGB) which was correctly interpreted in v0.24 and ignored in v0.25.
Here is the output of imagemagick identify:
$ identify -verbose /tmp/original-server-tile.jpg
Image:
Filename: /tmp/original-server-tile.jpg
Permissions: rw-r--r--
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 512x512+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: 262144
Red:
min: 32 (0.12549)
max: 243 (0.952941)
mean: 207.67 (0.814391)
median: 214 (0.839216)
standard deviation: 20.2158 (0.0792778)
kurtosis: 18.5473
skewness: -3.903
entropy: 0.620616
Green:
min: 24 (0.0941176)
max: 240 (0.941176)
mean: 197.969 (0.77635)
median: 206 (0.807843)
standard deviation: 23.8466 (0.0935161)
kurtosis: 13.2825
skewness: -3.14624
entropy: 0.714602
Blue:
min: 16 (0.0627451)
max: 227 (0.890196)
mean: 178.239 (0.698975)
median: 184 (0.721569)
standard deviation: 19.1504 (0.0750995)
kurtosis: 21.8043
skewness: -3.9469
entropy: 0.676309
Image statistics:
Overall:
min: 16 (0.0627451)
max: 243 (0.952941)
mean: 194.626 (0.763239)
median: 201.333 (0.789542)
standard deviation: 21.0709 (0.0826311)
kurtosis: 17.878
skewness: -3.66538
entropy: 0.670509
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: 512x512+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Quality: 76
Orientation: Undefined
Profiles:
Profile-exif: 40 bytes
Profile-icc: 868 bytes
Properties:
comment: (C) Google Inc.
date:create: 2024-09-25T09:24:48+00:00
date:modify: 2024-09-25T09:24:48+00:00
date:timestamp: 2024-09-25T13:02:32+00:00
exif:Software: Picasa
icc:copyright: Copyright (c) Eastman Kodak Company, 1999, all rights reserved.
icc:description: ProPhoto RGB
icc:manufacturer: KODAK
icc:model: Reference Output Medium Metric(ROMM)
jpeg:colorspace: 2
jpeg:sampling-factor: 1x1,1x1,1x1
signature: 1d40f53ad2a16840aa7c4f4fdfb06e4e361710ea69ce3afdf24d102118c0f48c
Artifacts:
verbose: true
Tainted: False
Filesize: 25514B
Number pixels: 262144
Pixel cache type: Memory
Pixels per second: 31.0766MP
User time: 0.010u
Elapsed time: 0:01.008
Version: ImageMagick 7.1.1-33 Q16-HDRI x86_64 22263 https://imagemagick.org
| original tile | tile with the embedded color profile stripped |
|---|---|
Seems a duplicate of https://github.com/image-rs/image/issues/2247
WebP, PNG and JPEG encoders allow setting ICC profile as of image v0.25.6