-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
I tried doing something like #26459 (comment) for mBA profiles with clut (support for that added in #26478). mABmBA.icc is from https://github.com/nico/jpegfiles/.
Build/lagom/bin/image -o burst-out-mABrgb.webp \
--assign-color-profile serenity-sRGB.icc \
--convert-to-color-profile /Users/thakis/src/jpegfiles/iccfiles/mABmBA.icc \
burst.png
Build/lagom/bin/image -o burst-out-mABrgb-rgb.webp \
--convert-to-color-profile serenity-sRGB.icc \
burst-out-mABrgb.webp
magick burst-out-magick-embed-srgb.png \
-profile /Users/thakis/src/jpegfiles/iccfiles/mABmBA.icc \
burst-out-magick-mab.png
magick burst-out-magick-mab.png \
-profile serenity-sRGB.icc \
burst-out-magick-mabrgb.png
% Build/lagom/bin/imgcmp \
burst-out-mABrgb-rgb.webp \
burst-out-magick-mabrgb.png
number of differing pixels: 15250441 (90.90%)
max error R: 29, G: 30, B: 29
avg error R: 1.04, G: 1.06, B: 1.18
max error at (2103, 0): rgb(0, 31, 81) vs rgb(3, 1, 81)
first difference at (0, 0): rgb(175, 115, 9) vs rgb(175, 113, 7)
sips -o burst-out-sips-mabrgb.png \
--matchTo /Users/thakis/src/jpegfiles/iccfiles/mABmBA.icc \
burst-out-sips-embed-srgb.png
sips -o burst-out-sips-mabrgb-rgb.png \
--matchTo serenity-sRGB.icc \
burst-out-sips-mabrgb.png
Build/lagom/bin/imgcmp \
burst-out-mABrgb-rgb.webp \
burst-out-sips-mabrgb-rgb.png
number of differing pixels: 16071334 (95.79%)
max error R: 31, G: 25, B: 24
avg error R: 1.21, G: 1.18, B: 1.22
max error at (2061, 1066): rgb(0, 30, 62) vs rgb(31, 8, 65)
first difference at (0, 0): rgb(175, 115, 9) vs rgb(176, 114, 12)
magick and sips also have almost no pixels in common and the average error rate looks comparable, but the max error is smaller:
% Build/lagom/bin/imgcmp burst-out-magick-mabrgb.png burst-out-sips-mabrgb-rgb.png
number of differing pixels: 16409669 (97.81%)
max error R: 11, G: 10, B: 11
avg error R: 1.43, G: 1.37, B: 1.41
max error at (3216, 3): rgb(9, 11, 1) vs rgb(12, 17, 12)
first difference at (0, 0): rgb(175, 113, 7) vs rgb(176, 114, 12)
Looking at the image, with sips and magick, dark areas stay dark:
But for us, they become gray:
I think the basic mAB / mBA math is all correct. However, the profile has a bkpt tag. It's a v4 profile and I think you're supposed to ignore the bkpt tag, but "6.3.4.3 PCS encodings for white and black" mentions:
Xb, Yb, Zb = XYZ values for the PCS perceptual black point (X = 0,003357, Y = 0,003479, Z = 0,002869)
And we don't have that black point in our source and don't do any black point adjustment. Maybe it's different for lut-based profiles (such as mABmBA.icc) and matrix-based profiles (such as serenity-sRGB.icc) or something. So maybe we have to rescale when we go from mABmBA data to PCS to get an actual black instead of the muted gray that's actually stored.
https://www.color.org/adobebpc.pdf describes something that's I think in the same area, but not quite what we have to do.