https://bugs.kde.org/show_bug.cgi?id=525876

Dmitry Kazakov <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #7 from Dmitry Kazakov <[email protected]> ---
Hi,  Zamundaaa!

It seems like there is still a bug somewhere in
`KWin->org.freedesktop.portal.Screenshot->Spectacle` pipeline. You said here
(and on IRC) that KWin provides data in gamma-2.2 format, but Spectacle assigns
sRGB ICC profile, which is against both, ICC and PNG specifications. It makes
round-tripping with color managed applications broken. Here are the steps to
reproduce:

1) Open Krita in Wayland mode (make sure that Relative Colorimetric intent is
used), create an image with sRGB ICC profile
2) Fill the image with color (10,10,10)
2) Make a screenshot with Spectacle and save into PNG
3) Open the screenshot in Krita and compare with the original document

BUG: The image looks much brighter. The color it is filled with is (18,18,18)
(which is a correct gamma-2.2 color), but the profile assigned to PNG is
sRGB-srgbtrc, which is incorrect.

4) Use Tools->Scripts->Assign Profile to assign "Rec 709 Gamma 2.2" profile to
the image (without any pixel conversion). The image will start looking exactly
as the original.

So, I see two solutions to the problem, depending on what is written in the
specification to `org.freedesktop.portal.Screenshot` (can we update it, btw?)

Option 1: KWin could encode the screen colors with a proper sRGB-srgbtrc curve.
The current behavior of gamma-2.2 encoding is just a hack to make
non-color-managed applications have  round-trip mode. Strictly speaking, this
hack is even against the original sRGB spec from 1999, which stipulates the
encoding part of the transform to always be piecewise-2.4, only the decoding
part is allowed to be gamma-2.2.

I understand that round-tripping with non-color-managed apps may be an
important usecase, but then it should be explicitly stated in the portal spec,
because this behavior is **not a standard sRGB** behavior (see option 2).

Option 2: Spectacle could just assign a gamma-2.2 profile to the final PNG
image, then it will be correct PNG file that can be used in a color managed
process. **But** that requires `org.freedesktop.portal.Screenshot` to
explicitly state what color space the provided buffer is. The data which KWin
provides right now is **not** sRGB, so it can be used as it is.

Personally, I feel like "option 2" is better, because PNG is usually saved in 8
bits, so resampling between gamma-2.2 and srgbtrc may be lossy. But I don't
know how we should proceed with adjusting `org.freedesktop.portal.Screenshot`
spec.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to