Bug 441162

Summary: Png file with gamma show washed out colours
Product: [Applications] gwenview Reporter: Raghavendra kamath <raghu>
Component: generalAssignee: Gwenview Bugs <gwenview-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ancoron.luciferis, idontfeelcomfygivingyoumyemail, mafriki, phd, shibotto
Priority: NOR    
Version First Reported In: 21.08.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=465066
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: base png test file
Screenshot showing the wrong colours of the png file in gwenview
The converted png file that I get from imagemagick
this-image-is-displayed-too-bright-in-gwenview.png

Description Raghavendra kamath 2021-08-19 10:33:17 UTC
Created attachment 140833 [details]
base png test file

SUMMARY
I have a script which converts a png file to another png file and a jpg file. To convert I use imagemagick's convert command. The resulting jpg file is alright but the png file has washed out light colours.

The command that I use is this

convert test.png -background white -alpha remove test-converted.png

The resulting file is properly displayed in firefox, google chrome, GIMP, krita, Okular, Showfoto etc. Only gwenview shows the colour in the image as washed out.

My monitor is calibrated and gwenview has perceptual rendering intent and also Apply only embedded colour profile enabled.


STEPS TO REPRODUCE
1. Open the attached png file
2. convert it using the imagemagick command  mentioned above to another png file
3. then open it in gwenview

OBSERVED RESULT
Colours are washed out

EXPECTED RESULT
Colours should appear how they are intended in the image

I am also attaching a screenshot showing how it looks on my screen

System Information:

Operating System: Arch Linux
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.13.10-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-4790K CPU @ 4.00GHz
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 750 Ti/PCIe/SSE2
Comment 1 Raghavendra kamath 2021-08-19 10:35:35 UTC
Created attachment 140834 [details]
Screenshot showing the wrong colours of the png file in gwenview

Adding the screenshot which shows how gwenview shows the converted png file for me.
Comment 2 Raghavendra kamath 2021-08-19 10:36:23 UTC
Created attachment 140835 [details]
The converted png file that I get from imagemagick

Also attaching the png file that is got from imagemagick command
Comment 3 2wxsy58236r3 2021-08-22 10:37:56 UTC
See also:
https://github.com/ImageMagick/ImageMagick/issues/4102
Comment 4 Shiba 2021-08-31 22:58:57 UTC
This commit introduced the issue: https://invent.kde.org/graphics/gwenview/-/commit/ac47787
Comment 5 Han Prower 2021-09-06 20:13:35 UTC
Just to make sure people don't think it's a specific ImageMagick export issue some 8bit PNGs exported from Photoshop suffer the same issue so it may be helpful to remove "imagemagick" from the title.
Comment 6 2wxsy58236r3 2021-12-21 01:35:19 UTC
*** Bug 447308 has been marked as a duplicate of this bug. ***
Comment 7 2wxsy58236r3 2022-02-15 00:57:58 UTC
*** Bug 450205 has been marked as a duplicate of this bug. ***
Comment 8 Ancoron 2022-02-15 07:24:42 UTC
The actual issue here is that gwenview (or Qt) interprets the gamma value incorrectly. ImageMagick (and other tools) set a default gamma of 2.2 for PNG's and/or other file formats that support this metadata.

For the attached files, here's some metadata:

test.png:

Bit Depth                       : 8
Color Type                      : RGB with Alpha
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Pixels Per Unit X               : 11811
Pixels Per Unit Y               : 11811
Pixel Units                     : meters
Image Size                      : 1800x2700


hires.png:

Bit Depth                       : 8
Color Type                      : RGB
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Gamma                           : 2.2       <<< creating trouble for gwenview
White Point X                   : 0.3127
White Point Y                   : 0.329
Red X                           : 0.64
Red Y                           : 0.33
Green X                         : 0.3
Green Y                         : 0.6
Blue X                          : 0.15
Blue Y                          : 0.06
Background Color                : 255 255 255
Pixels Per Unit X               : 11811
Pixels Per Unit Y               : 11811
Pixel Units                     : meters
Modify Date                     : 2021:08:19 10:24:04
Warning                         : [minor] Text chunk(s) found after PNG IDAT (may be ignored by some readers)
Datecreate                      : 2021-08-19T10:23:53+00:00
Datemodify                      : 2021-08-19T08:57:54+00:00
Image Size                      : 1800x2700


You can "fix" the PNG's for gwenview usually with: `convert <input> -set gamma 2.2 <output>`

...which actually sets the PNG gamma value to 0.4545, since it's the inverse (and which is what gwenview should be doing).

However, that breaks the image for almost any other viewer/browser/editor that interpret the gamma value, since they then are doing the color correction in the inverse way with the inversed value.

Some background on why it is the way it is: https://www.cambridgeincolour.com/tutorials/gamma-correction.htm
Comment 9 phd 2022-02-15 15:43:44 UTC
Created attachment 146774 [details]
this-image-is-displayed-too-bright-in-gwenview.png
Comment 10 phd 2022-02-15 15:48:33 UTC
I think this should be a 15-minute bug.
Browsing images is a very typical use case, and hitting this bug does not leave a good impression.
Comment 11 phd 2022-02-16 14:18:00 UTC
I couldn't reproduce this bug in KDE neon:
Gwenview 22.03.70 (KDE neon dev packages), 22.03.70 (git master), 21.12.2 (git tag), 21.08.0 (git tag)
KF 5.91.0 and Qt 5.15.3

However it is reproducible in Kubuntu 21.10:
Gwenview 21.12.2, KF 5.91.0 and Qt 5.15.2

So, was it fixed in Qt 5.15.2 -> 5.15.3?
Comment 12 Ancoron 2022-02-17 12:11:35 UTC
@phd Yes, it looks like a Qt bug to me as well, since the code changes that supposedly introduced this regression only incorporate color correction using Qt interfaces.
Comment 13 phd 2022-09-20 10:32:51 UTC
Still happening in Ubuntu 22.04 with Gwenview 22.04.3.
Qt is now updated to 5.15.3
KDE Frameworks 5.98.0
Comment 14 A Linux User 2025-08-22 11:59:55 UTC
Thank you for the bug report. Unfortunately we were not able to get to it yet. Can we ask you to please check if this is still an issue with Gwenview 25.08.0?
Comment 15 Ancoron 2025-08-22 18:21:57 UTC
(In reply to A Linux User from comment #14)
> Thank you for the bug report. Unfortunately we were not able to get to it
> yet. Can we ask you to please check if this is still an issue with Gwenview
> 25.08.0?

No longer a problem for me.

I recently switched from X11 to Wayland and since HDR/10bit display support has landed and I am using a 10bit display, colors are no longer washed out for me. So I am not sure which change "fixed" it for me, either the HDR/10bit support or the switch to Wayland