Browse Source

AnyImageConverter: recognize WebP files.

pull/638/head
Vladimír Vondruš 2 years ago
parent
commit
e7f95c73b5
  1. 1
      doc/changelog.dox
  2. 2
      src/MagnumPlugins/AnyImageConverter/AnyImageConverter.cpp
  3. 2
      src/MagnumPlugins/AnyImageConverter/AnyImageConverter.h
  4. 3
      src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp

1
doc/changelog.dox

@ -871,6 +871,7 @@ See also:
[mosra/magnum#529](https://github.com/mosra/magnum/pull/529))
- Recognizing KTX2 for (compressed) 1D/2D/3D and multi-level 1D/2D/3D images
in @relativeref{Trade,AnyImageConverter}
- Recognizing WebP files in @relativeref{Trade,AnyImageConverter}
- Recognizing glTF files in @relativeref{Trade,AnySceneConverter}
- Recognizing 3MF files in @relativeref{Trade,AnySceneImporter}
- Recognizing OpenVBD files in @relativeref{Trade,AnyImageImporter} and

2
src/MagnumPlugins/AnyImageConverter/AnyImageConverter.cpp

@ -132,6 +132,8 @@ bool AnyImageConverter::doConvertToFile(const ImageView2D& image, const Containe
normalizedExtension == ".icb"_s ||
normalizedExtension == ".vst"_s)
plugin = "TgaImageConverter"_s;
else if(normalizedExtension == ".webp"_s)
plugin = "WebPImageConverter"_s;
else {
Error{} << "Trade::AnyImageConverter::convertToFile(): cannot determine the format of" << filename << "for a 2D image";
return false;

2
src/MagnumPlugins/AnyImageConverter/AnyImageConverter.h

@ -78,6 +78,8 @@ tries to convert the file with it. Supported formats:
uncompressed 2D images.
- OpenVDB (`*.vdb`), converted with any plugin that provides
`OpenVdbImageConverter`. Only uncompressed 3D images.
- WebP (`*.webp`), converted with @ref WebPImageConverter or any other plugin
that provides it. Only uncompressed 2D images.
As the converter plugin is picked based on file extension, only saving to files
is supported.

3
src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp

@ -161,7 +161,8 @@ constexpr struct {
/* Have at least one test case with uppercase */
{"JPEG uppercase", "output.JPG", "JpegImageConverter"},
{"KTX2", "foo.ktx2", "KtxImageConverter"},
{"PNG", "file.png", "PngImageConverter"}
{"PNG", "file.png", "PngImageConverter"},
{"WebP", "file.webp", "WebPImageConverter"}
};
constexpr struct {

Loading…
Cancel
Save