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

LibGfx: Start adding a utility for handling ICC color profiles

For now, this dumps file version and device class.

https://github.com/saucecontrol/compact-icc-profiles has good
test inputs.
This commit is contained in:
Nico Weber 2022-12-26 08:21:54 -05:00 committed by Andrew Kaster
parent d8867f8077
commit 7f52f45e9d
3 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2022, Nico Weber <thakis@chromium.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/StringView.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/MappedFile.h>
#include <LibGfx/ICCProfile.h>
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
Core::ArgsParser args_parser;
static StringView icc_path;
args_parser.add_positional_argument(icc_path, "Path to ICC profile", "FILE");
args_parser.parse(arguments);
auto icc_file = TRY(Core::MappedFile::map(icc_path));
auto profile = TRY(Gfx::ICC::Profile::try_load_from_externally_owned_memory(icc_file->bytes()));
outln("version: {}", profile->version());
outln("device class: {}", Gfx::ICC::device_class_name(profile->device_class()));
return 0;
}