1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:27:44 +00:00

LibGfx/TIFF: Support WhiteIsZero parameter for grayscale images

PhotometricInterpretation::WhiteIsZero is used to inverse black and
white on bilevel and grayscale images.
This commit is contained in:
Lucas CHOLLET 2023-12-01 19:29:55 -05:00 committed by Andreas Kling
parent 64d7e386d2
commit 3ae29fdeec

View file

@ -97,7 +97,11 @@ private:
}
if (*m_metadata.samples_per_pixel() == 1) {
auto const luminosity = TRY(read_component(stream, bits_per_sample[0]));
auto luminosity = TRY(read_component(stream, bits_per_sample[0]));
if (m_metadata.photometric_interpretation() == PhotometricInterpretation::WhiteIsZero)
luminosity = ~luminosity;
return Color(luminosity, luminosity, luminosity);
}