Skip to content

Commit

Permalink
image: Support writing to PPM files
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasChollet authored and linusg committed Mar 13, 2023
1 parent 9c9bd27 commit 13d1721
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Userland/Utilities/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <LibGfx/BMPWriter.h>
#include <LibGfx/ImageDecoder.h>
#include <LibGfx/PNGWriter.h>
#include <LibGfx/PortableFormatWriter.h>
#include <LibGfx/QOIWriter.h>

ErrorOr<int> serenity_main(Main::Arguments arguments)
Expand Down Expand Up @@ -41,10 +42,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
bytes = TRY(Gfx::BMPWriter::encode(*frame));
} else if (out_path.ends_with(".png"sv, CaseSensitivity::CaseInsensitive)) {
bytes = TRY(Gfx::PNGWriter::encode(*frame));
} else if (out_path.ends_with(".ppm"sv, CaseSensitivity::CaseInsensitive)) {
bytes = TRY(Gfx::PortableFormatWriter::encode(*frame));
} else if (out_path.ends_with(".qoi"sv, CaseSensitivity::CaseInsensitive)) {
bytes = TRY(Gfx::QOIWriter::encode(*frame));
} else {
warnln("can only write .bmp, .png, and .qoi");
warnln("can only write .bmp, .png, .ppm, and .qoi");
return 1;
}

Expand Down

0 comments on commit 13d1721

Please sign in to comment.