mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:44:58 +00:00
image: Add --assign-color-profile= flag
This allows assigning a color profile from a .icc file to the output. No pixel data conversion is taking place: the output will just contain this profile, so it better matches the image data already.
This commit is contained in:
parent
e05bb47134
commit
0591aa1d96
1 changed files with 9 additions and 0 deletions
|
@ -26,6 +26,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool ppm_ascii;
|
||||
args_parser.add_option(ppm_ascii, "Convert to a PPM in ASCII", "ppm-ascii", {});
|
||||
|
||||
StringView assign_color_profile_path;
|
||||
args_parser.add_option(assign_color_profile_path, "Load color profile from file and assign it to output image", "assign-color-profile", {}, "FILE");
|
||||
|
||||
bool strip_color_profile;
|
||||
args_parser.add_option(strip_color_profile, "Do not write color profile to output", "strip-color-profile", {});
|
||||
|
||||
|
@ -44,6 +47,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto frame = TRY(decoder->frame(0)).image;
|
||||
Optional<ReadonlyBytes> icc_data = TRY(decoder->icc_data());
|
||||
|
||||
RefPtr<Core::MappedFile> icc_file;
|
||||
if (!assign_color_profile_path.is_empty()) {
|
||||
icc_file = TRY(Core::MappedFile::map(assign_color_profile_path));
|
||||
icc_data = icc_file->bytes();
|
||||
}
|
||||
|
||||
if (strip_color_profile)
|
||||
icc_data.clear();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue