diff --git a/Userland/Utilities/image.cpp b/Userland/Utilities/image.cpp index 1b2d54bed4b..f1bd4a79d75 100644 --- a/Userland/Utilities/image.cpp +++ b/Userland/Utilities/image.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -168,6 +169,10 @@ static ErrorOr save_image(LoadedImage& image, StringView out_path, bool pp auto& frame = image.bitmap.get>(); + if (out_path.ends_with(".gif"sv, CaseSensitivity::CaseInsensitive)) { + TRY(Gfx::GIFWriter::encode(*TRY(stream()), *frame)); + return {}; + } if (out_path.ends_with(".jpg"sv, CaseSensitivity::CaseInsensitive) || out_path.ends_with(".jpeg"sv, CaseSensitivity::CaseInsensitive)) { TRY(Gfx::JPEGWriter::encode(*TRY(stream()), *frame, { .icc_data = image.icc_data, .quality = jpeg_quality })); return {}; @@ -190,7 +195,7 @@ static ErrorOr save_image(LoadedImage& image, StringView out_path, bool pp } else if (out_path.ends_with(".qoi"sv, CaseSensitivity::CaseInsensitive)) { bytes = TRY(Gfx::QOIWriter::encode(*frame)); } else { - return Error::from_string_view("can only write .bmp, .jpg, .png, .ppm, .qoi, and .webp"sv); + return Error::from_string_view("can only write .bmp, .gif, .jpg, .png, .ppm, .qoi, and .webp"sv); } TRY(TRY(stream())->write_until_depleted(bytes));