mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:17:35 +00:00
image: Support JPEG as an output format
This commit is contained in:
parent
226b214142
commit
b7c30f3096
1 changed files with 4 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include <LibGfx/ICC/Profile.h>
|
#include <LibGfx/ICC/Profile.h>
|
||||||
#include <LibGfx/ImageFormats/BMPWriter.h>
|
#include <LibGfx/ImageFormats/BMPWriter.h>
|
||||||
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
||||||
|
#include <LibGfx/ImageFormats/JPEGWriter.h>
|
||||||
#include <LibGfx/ImageFormats/PNGWriter.h>
|
#include <LibGfx/ImageFormats/PNGWriter.h>
|
||||||
#include <LibGfx/ImageFormats/PortableFormatWriter.h>
|
#include <LibGfx/ImageFormats/PortableFormatWriter.h>
|
||||||
#include <LibGfx/ImageFormats/QOIWriter.h>
|
#include <LibGfx/ImageFormats/QOIWriter.h>
|
||||||
|
@ -152,6 +153,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
auto const format = ppm_ascii ? Gfx::PortableFormatWriter::Options::Format::ASCII : Gfx::PortableFormatWriter::Options::Format::Raw;
|
auto const format = ppm_ascii ? Gfx::PortableFormatWriter::Options::Format::ASCII : Gfx::PortableFormatWriter::Options::Format::Raw;
|
||||||
TRY(Gfx::PortableFormatWriter::encode(*buffered_stream, *frame, { .format = format }));
|
TRY(Gfx::PortableFormatWriter::encode(*buffered_stream, *frame, { .format = format }));
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (out_path.ends_with(".jpg"sv, CaseSensitivity::CaseInsensitive) || out_path.ends_with(".jpeg"sv, CaseSensitivity::CaseInsensitive)) {
|
||||||
|
TRY(Gfx::JPEGWriter::encode(*buffered_stream, *frame));
|
||||||
|
return 0;
|
||||||
} else if (out_path.ends_with(".qoi"sv, CaseSensitivity::CaseInsensitive)) {
|
} else if (out_path.ends_with(".qoi"sv, CaseSensitivity::CaseInsensitive)) {
|
||||||
bytes = TRY(Gfx::QOIWriter::encode(*frame));
|
bytes = TRY(Gfx::QOIWriter::encode(*frame));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue