mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
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.)
This commit is contained in:
parent
4bf639b635
commit
f7e152d049
7 changed files with 359 additions and 0 deletions
|
@ -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) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue