diff --git a/doc/changelog.dox b/doc/changelog.dox index 4b887468a..ff78d7039 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -44,6 +44,12 @@ See also: - Added @ref Math::fmod() (see [mosra/magnum#454](https://github.com/mosra/magnum/pull/454)) +@subsection changelog-latest-changes Changes and improvements + +@subsubsection changelog-latest-changes-trade Trade library + +- Recognizing TIFF file header magic in @ref Trade::AnyImageImporter "AnyImageImporter" + @subsection changelog-latest-buildsystem Build system - Fixed compilation of the @ref GL library on macOS with ANGLE --- new code diff --git a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp index 1093dad26..635cc9923 100644 --- a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp +++ b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp @@ -165,6 +165,11 @@ void AnyImageImporter::doOpenData(Containers::ArrayView data) { /* https://en.wikipedia.org/wiki/Portable_Network_Graphics#File_header */ else if(Utility::String::viewBeginsWith(data, "\x89PNG\x0d\x0a\x1a\x0a")) plugin = "PngImporter"; + /* http://paulbourke.net/dataformats/tiff/, + http://paulbourke.net/dataformats/tiff/tiff_summary.pdf */ + else if(Utility::String::viewBeginsWith(data, "II\x2a\x00") || + Utility::String::viewBeginsWith(data, "MM\x00\x2a")) + plugin = "TiffImporter"; /* https://github.com/file/file/blob/d04de269e0b06ccd0a7d1bf4974fed1d75be7d9e/magic/Magdir/images#L18-L22 TGAs are a complete guesswork, so try after everything else fails. */ else if([data]() { diff --git a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h index 7b875bc15..50893d5e0 100644 --- a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h +++ b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h @@ -88,8 +88,8 @@ tries to open the file with it. Supported formats: - Adobe Photoshop (`*.psd`), loaded with any plugin that provides `PsdImporter` - Silicon Graphics (`*.sgi`, `*.bw`, `*.rgb`, `*.rgba`), loaded with any plugin that provides `SgiImporter` -- Tagged Image File Format (`*.tif`, `*.tiff`), loaded with any plugin that - provides `TiffImporter` +- Tagged Image File Format (`*.tif`, `*.tiff` or data with corresponding + signature), loaded with any plugin that provides `TiffImporter` - Truevision TGA (`*.tga`, `*.vda`, `*.icb`, `*.vst` or data with corresponding signature), loaded with @ref TgaImporter or any other plugin that provides it diff --git a/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp b/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp index 2739d689b..57d62c5a0 100644 --- a/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp +++ b/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp @@ -92,6 +92,7 @@ constexpr struct { {"GIF", "image.gif", nullptr, "GifImporter"}, {"PSD", "image.psd", nullptr, "PsdImporter"}, {"TIFF", "image.tiff", nullptr, "TiffImporter"}, + {"TIFF data", "image.tiff", fileCallback, "TiffImporter"}, {"Basis", "rgb.basis", nullptr, "BasisImporter"} /* Not testing everything, just the most important ones */ }; diff --git a/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt b/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt index e23a03054..babc8364c 100644 --- a/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt @@ -53,6 +53,7 @@ corrade_add_test(AnyImageImporterTest AnyImageImporterTest.cpp FILES gray.jpg image.exr + image.tiff pngs.ico rgb.basis rgb.hdr diff --git a/src/MagnumPlugins/AnyImageImporter/Test/image.tiff b/src/MagnumPlugins/AnyImageImporter/Test/image.tiff new file mode 100644 index 000000000..0b3ee543a Binary files /dev/null and b/src/MagnumPlugins/AnyImageImporter/Test/image.tiff differ