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

LibGfx/TIFF: Add support for CMYK

The test case has been generated with Krita.
This commit is contained in:
Lucas CHOLLET 2024-01-18 19:57:05 -05:00 committed by Andrew Kaster
parent 984272d83e
commit a17041fe7f
3 changed files with 67 additions and 12 deletions

View file

@ -700,6 +700,19 @@ TEST_CASE(test_tiff_16_bits)
EXPECT_EQ(frame.image->get_pixel(60, 75), Gfx::Color::NamedColor::Red);
}
TEST_CASE(test_tiff_cmyk)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("tiff/cmyk.tiff"sv)));
EXPECT(Gfx::TIFFImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::TIFFImageDecoderPlugin::create(file->bytes()));
auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 400, 300 }));
EXPECT_EQ(frame.image->get_pixel(0, 0), Gfx::Color::NamedColor::White);
// I stripped the ICC profile from the image, so we can't test for equality with Red here.
EXPECT_NE(frame.image->get_pixel(60, 75), Gfx::Color::NamedColor::White);
}
TEST_CASE(test_tiff_invalid_tag)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("tiff/invalid_tag.tiff"sv)));