1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:47:45 +00:00

LibGfx/TIFF: Add support for the ICCProfile tag

This commit is contained in:
Lucas CHOLLET 2023-11-28 21:16:43 -05:00 committed by Andreas Kling
parent 5622e7d77c
commit 4994609af0
5 changed files with 26 additions and 0 deletions

View file

@ -12,6 +12,7 @@
#include <LibGfx/ICC/WellKnownProfiles.h>
#include <LibGfx/ImageFormats/JPEGLoader.h>
#include <LibGfx/ImageFormats/PNGLoader.h>
#include <LibGfx/ImageFormats/TIFFLoader.h>
#include <LibGfx/ImageFormats/WebPLoader.h>
#include <LibTest/TestCase.h>
@ -76,6 +77,17 @@ TEST_CASE(webp_extended_lossy)
EXPECT(icc_profile->is_v2());
}
TEST_CASE(tiff)
{
auto file = MUST(Core::MappedFile::map(TEST_INPUT("icc/icc.tiff"sv)));
auto tiff = MUST(Gfx::TIFFImageDecoderPlugin::create(file->bytes()));
auto icc_bytes = MUST(tiff->icc_data());
EXPECT(icc_bytes.has_value());
auto icc_profile = MUST(Gfx::ICC::Profile::try_load_from_externally_owned_memory(icc_bytes.value()));
EXPECT(icc_profile->is_v4());
}
TEST_CASE(serialize_icc)
{
auto file = MUST(Core::MappedFile::map(TEST_INPUT("icc/p3-v4.icc"sv)));