1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:07:35 +00:00

LibGfx/ICC: Implement conversion between different connection spaces

If one profile uses PCSXYZ and the other PCSLAB as connection space,
we now do the necessary XYZ/LAB conversion.

With this and the previous commits, we can now convert from profiles
that use PCSLAB with mAB, such as stress.jpeg from
https://littlecms.com/blog/2020/09/09/browser-check/ :

    % Build/lagom/icc --name sRGB --reencode-to serenity-sRGB.icc
    % Build/lagom/bin/image -o out.png \
        --convert-to-color-profile serenity-sRGB.icc \
        ~/src/jpegfiles/stress.jpeg
This commit is contained in:
Nico Weber 2023-12-03 21:40:47 -05:00 committed by Sam Atkins
parent 9f7b33c31f
commit b2a1130556
4 changed files with 40 additions and 10 deletions

View file

@ -506,7 +506,7 @@ PDFErrorOr<Color> ICCBasedColorSpace::color(ReadonlySpan<Value> arguments) const
auto pcs = TRY(m_profile->to_pcs(bytes));
Array<u8, 3> output;
TRY(s_srgb_profile->from_pcs(pcs, output.span()));
TRY(s_srgb_profile->from_pcs(m_profile, pcs, output.span()));
return Color(output[0], output[1], output[2]);
}