Bug 420357 - gwenview shows faded version of image after cropping
Summary: gwenview shows faded version of image after cropping
Status: RESOLVED FIXED
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: 19.12.3
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-20 20:39 UTC by Philip Webb
Modified: 2021-09-24 10:09 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
uncropped image (148.84 KB, image/png)
2020-04-20 20:39 UTC, Philip Webb
Details
cropped image : view with another viewer, eg Feh Gqview (33.91 KB, image/png)
2020-04-20 20:40 UTC, Philip Webb
Details
cropped image as shown by Gwenview in faded/bleached appearance (screenshot) (56.92 KB, image/png)
2020-04-20 20:41 UTC, Philip Webb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Webb 2020-04-20 20:39:18 UTC
Created attachment 127726 [details]
uncropped image

SUMMARY : after Gwenview 19.12.3 is used to crop a .png image & the saved result is viewed in Gwenview, the image appears to be faded or bleached.  The same image file appears correctly in Feh Gqview Xv.  The bad view of the image is not corrected when the machine is rebooted.


STEPS TO REPRODUCE
1. Use Gwenview to crop a .png image.
2. View the resulting saved file in Gwenview after going to another folder.
3. 

OBSERVED RESULT : the image appears to be faded or bleached


EXPECTED RESULT : the image should show in full color, as it does in Feh.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 5.17.5 (these are the latest stable versions in Gentoo)
(available in About System)
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.67.0
Qt Version: 5.14.1

ADDITIONAL INFORMATION : Many previous croppings haven't shown this bug,
which seems to have started after upgrading to 19.12.3 on 21 March 2020.
Comment 1 Philip Webb 2020-04-20 20:40:33 UTC
Created attachment 127727 [details]
cropped image : view with another viewer, eg Feh Gqview
Comment 2 Philip Webb 2020-04-20 20:41:55 UTC
Created attachment 127728 [details]
cropped image as shown by Gwenview in faded/bleached appearance (screenshot)
Comment 3 Philip Webb 2021-09-17 07:24:56 UTC
This bug is still happening with Gwenview 21.04.3 .
It seems to happen after the cropped image is saved in place, ie same name.
I am now using Qt 5.15.2 , Frameworks 5.82.0 , Plasma 5.21.5 .
My system is still stable Gentoo.
Comment 4 Nagy Tibor 2021-09-17 08:40:46 UTC
My guess this happens due to botched gamma handling. Washed out images are a prime symptom of that kind of bugs.
Comment 5 Nagy Tibor 2021-09-17 13:27:54 UTC
Seems like when a PNG gAMA chunk is present Gwenview applies the gamma transform in the opposite direction it should. Thus the washed out images.
Comment 6 Nagy Tibor 2021-09-17 14:39:13 UTC
Seems to be Qt bug, already fixed in 5.15.x:
https://github.com/qt/qtbase/commit/de2c3ccd49cb89e0c6912da3b03705a36ef03946
Comment 7 Philip Webb 2021-09-18 10:07:45 UTC
Thanks for your prompt response.  Do you know which version of Qt contains the fix ? -- it doesn't seem to be 5.15.2-r3 (Gentoo), which I am using.
5.15.2-r10 is available in Gentoo testing : I assume I need qt-core (Gentoo).
The Github date is June 11, which I assume is 2021, so it may not have reached Gentoo yet (Gentoo stable is fairly prompt, but by no means instant).
Comment 8 Nagy Tibor 2021-09-18 14:50:44 UTC
No idea exactly how/when/where it's gonna reach you, I'm clueless about Qt's and Gentoo's release model.
Comment 9 Andreas Sturmlechner 2021-09-23 07:52:34 UTC
(In reply to Nagy Tibor from comment #6)
> Seems to be Qt bug, already fixed in 5.15.x:
> https://github.com/qt/qtbase/commit/de2c3ccd49cb89e0c6912da3b03705a36ef03946
The linked commit was not yet cherry-picked to kde/5.15 branch, so it can not be available in Gentoo either.

The relevant backports tracker issue is still open/pending: https://invent.kde.org/qt/backports-tracker/-/issues/864
Comment 10 Andreas Sturmlechner 2021-09-23 07:55:45 UTC
Philip, since you are a Gentoo user, please test the patch to dev-qt/qtgui (https://github.com/qt/qtbase/commit/de2c3ccd49cb89e0c6912da3b03705a36ef03946.patch) by means of the Gentoo user patch mechanism: https://wiki.gentoo.org/wiki//etc/portage/patches
Comment 11 Bug Janitor Service 2021-09-23 08:16:26 UTC
A possibly relevant merge request was started @ https://invent.kde.org/qt/qt/qtbase/-/merge_requests/53
Comment 12 Michael 2021-09-23 09:18:21 UTC
(In reply to Andreas Sturmlechner from comment #10)
> Philip, since you are a Gentoo user, please test the patch to dev-qt/qtgui
> (https://github.com/qt/qtbase/commit/
> de2c3ccd49cb89e0c6912da3b03705a36ef03946.patch) by means of the Gentoo user
> patch mechanism: https://wiki.gentoo.org/wiki//etc/portage/patches

I tested the patch, it fixes the issue for me.
Comment 13 Philip Webb 2021-09-23 11:37:44 UTC
To Michael : thanks for testing this ; hopefully, that wb sufficient.

To Andreas : I've looked at the Portage patches procedure & it does look rather complex.  Esp, I don't know which Gentoo package is involved : the patch refers to Qtbase, but Gentoo only has Qtcore.  While this is clearly a bug which needs fixing in Qt -- the patch shows an elementary omission by the original coder -- , I have found  2  workarounds which avoid the problem in my everyday activity,
so its no longer a regular irritant to me.

Hopefully, the Qt file wb patched & a new version will arrive at Gentoo soon.
Comment 14 Andreas Sturmlechner 2021-09-23 11:41:29 UTC
(In reply to Philip Webb from comment #13)
> To Andreas : I've looked at the Portage patches procedure & it does look
> rather complex.
Like so:
> # mkdir /etc/portage/patches/dev-qt/qtgui
> # wget https://github.com/qt/qtbase/commit/de2c3ccd.patch
> # mv de2c3ccd.patch /etc/portage/patches/dev-qt/qtgui/
> # emerge -1v qtgui
Comment 15 Andreas Sturmlechner 2021-09-23 22:44:15 UTC
Git commit a4f9e56975fa6ab4a1f63a9b34a4d77b1cfe4acd by Andreas Sturmlechner, on behalf of Allan Sandfeld Jensen.
Committed on 23/09/2021 at 08:07.
Pushed by apol into branch 'kde/5.15'.

Fix reading gamma from PNGs without ICC profile

The decoding of PNG_INFO_gAMA to QColorSpace was incorrect, the PNG
gamma is the inverse of the gamma value we use. We revert it
everywhere else, just not here.
Pick-to: 6.2 5.15
Change-Id: Ic0ae1963b2dde3004cac8a6430ddaf99e7096915
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit de2c3ccd49cb89e0c6912da3b03705a36ef03946)

M  +2    -2    src/gui/image/qpnghandler.cpp

https://invent.kde.org/qt/qt/qtbase/commit/a4f9e56975fa6ab4a1f63a9b34a4d77b1cfe4acd
Comment 16 Philip Webb 2021-09-24 10:09:35 UTC
I followed the steps listed in Comment 14 , remerged Gwenview, rebooted.
Then I made a PNG screenshot, cropped it, saved it in place (same name).
Gwenview shows it in full color.  So the patch seems to remove the bug.