mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
image: Add --strip-color-profile flag
With this flag, no color profile is copied from the source image to the destination image.
This commit is contained in:
parent
14581e98ad
commit
e05bb47134
1 changed files with 6 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", {});
|
||||
|
||||
bool strip_color_profile;
|
||||
args_parser.add_option(strip_color_profile, "Do not write color profile to output", "strip-color-profile", {});
|
||||
|
||||
args_parser.parse(arguments);
|
||||
|
||||
if (out_path.is_empty()) {
|
||||
|
@ -41,6 +44,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto frame = TRY(decoder->frame(0)).image;
|
||||
Optional<ReadonlyBytes> icc_data = TRY(decoder->icc_data());
|
||||
|
||||
if (strip_color_profile)
|
||||
icc_data.clear();
|
||||
|
||||
ByteBuffer bytes;
|
||||
if (out_path.ends_with(".bmp"sv, CaseSensitivity::CaseInsensitive)) {
|
||||
bytes = TRY(Gfx::BMPWriter::encode(*frame, { .icc_data = icc_data }));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue