mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +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
Notes:
sideshowbarker
2024-07-17 03:25:24 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/e05bb47134 Pull-request: https://github.com/SerenityOS/serenity/pull/17880 Reviewed-by: https://github.com/trflynn89
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…
Reference in a new issue