diff options
author | Nico Weber <thakis@chromium.org> | 2023-02-23 22:37:08 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-24 19:44:20 +0100 |
commit | f7e152d049f760fcd3ede7e3f9b1761b9800df0d (patch) | |
tree | edd97d4a34a61214ac51f591bd9fa3782b9bfa0e /Userland/Libraries/LibCore | |
parent | 4bf639b63598791fe746e3cde17b89319a19b59f (diff) | |
download | serenity-f7e152d049f760fcd3ede7e3f9b1761b9800df0d.zip |
LibGfx: Add scaffolding for a webp decoder
At the moment, this processes the RIFF chunk structure and extracts
the ICCP chunk, so that `icc` can now print ICC profiles embedded
in webp files. (And are image files really more than containers
of icc profiles?)
It doesn't even decode image dimensions yet.
The lossy format is a VP8 video frame. Once we get to that, we
might want to move all the image decoders into a new LibImageDecoders
that depends on both LibGfx and LibVideo. (Other newer image formats
like heic and av1f also use video frames for image data.)
Diffstat (limited to 'Userland/Libraries/LibCore')
-rw-r--r-- | Userland/Libraries/LibCore/MimeData.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/MimeData.cpp b/Userland/Libraries/LibCore/MimeData.cpp index d679ea53b3..7e08ebea1b 100644 --- a/Userland/Libraries/LibCore/MimeData.cpp +++ b/Userland/Libraries/LibCore/MimeData.cpp @@ -73,6 +73,8 @@ StringView guess_mime_type_based_on_filename(StringView path) return "image/svg+xml"sv; if (path.ends_with(".tga"sv, CaseSensitivity::CaseInsensitive)) return "image/x-targa"sv; + if (path.ends_with(".webp"sv, CaseSensitivity::CaseInsensitive)) + return "image/webp"sv; if (path.ends_with(".md"sv, CaseSensitivity::CaseInsensitive)) return "text/markdown"sv; if (path.ends_with(".html"sv, CaseSensitivity::CaseInsensitive) || path.ends_with(".htm"sv, CaseSensitivity::CaseInsensitive)) @@ -152,6 +154,7 @@ StringView guess_mime_type_based_on_filename(StringView path) __ENUMERATE_MIME_TYPE_HEADER(tiff_bigendian, "image/tiff", 0, 4, 'M', 'M', 0x00, '*') \ __ENUMERATE_MIME_TYPE_HEADER(wasm, "application/wasm", 0, 4, 0x00, 'a', 's', 'm') \ __ENUMERATE_MIME_TYPE_HEADER(wav, "audio/wave", 8, 4, 'W', 'A', 'V', 'E') \ + __ENUMERATE_MIME_TYPE_HEADER(webp, "image/webp", 8, 4, 'W', 'E', 'B', 'P') \ __ENUMERATE_MIME_TYPE_HEADER(win_31x_archive, "extra/win-31x-compressed", 0, 4, 'K', 'W', 'A', 'J') \ __ENUMERATE_MIME_TYPE_HEADER(win_95_archive, "extra/win-95-compressed", 0, 4, 'S', 'Z', 'D', 'D') \ __ENUMERATE_MIME_TYPE_HEADER(zlib_0, "extra/raw-zlib", 0, 2, 0x78, 0x01) \ |