diff --git a/doc/file-formats.dox b/doc/file-formats.dox
index 4121002b5..03cefba62 100644
--- a/doc/file-formats.dox
+++ b/doc/file-formats.dox
@@ -70,6 +70,16 @@ Together with @ref file-formats-scene-importers "scene importers" derived from
|
+
+| ASTC (`*.astc`) |
+`AstcImporter` |
+@relativeref{Trade,AstcImporter} |
+@ref Trade-AstcImporter-behavior "none" |
+@m_span{m-text m-dim} none @m_endspan |
+ |
+
+ |
+
| Basis Universal (`*.basis`) |
`BasisImporter` |
diff --git a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp
index 90fd1fd10..d8cdfcd55 100644
--- a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp
+++ b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp
@@ -71,7 +71,9 @@ void AnyImageImporter::doOpenFile(const Containers::StringView filename) {
/* Detect the plugin from extension */
Containers::StringView plugin;
- if(normalizedExtension == ".basis"_s)
+ if(normalizedExtension == ".astc"_s)
+ plugin = "AstcImporter"_s;
+ else if(normalizedExtension == ".basis"_s)
plugin = "BasisImporter"_s;
else if(normalizedExtension == ".bmp"_s)
plugin = "BmpImporter"_s;
@@ -173,8 +175,12 @@ void AnyImageImporter::doOpenData(Containers::Array&& data, DataFlags) {
const Containers::StringView dataString = dataView;
Containers::StringView plugin;
+ /* https://stackoverflow.com/questions/22600678/determine-internal-format-of-given-astc-compressed-image-through-its-header
+ unfortunately it being in LE means it's SCALABLE in reverse :) */
+ if(dataString.hasPrefix("\x13\xAB\xA1\x5C"_s))
+ plugin = "AstcImporter"_s;
/* https://github.com/BinomialLLC/basis_universal/blob/7d784c728844c007d8c95d63231f7adcc0f65364/transcoder/basisu_file_headers.h#L78 */
- if(dataString.hasPrefix("sB"_s))
+ else if(dataString.hasPrefix("sB"_s))
plugin = "BasisImporter"_s;
/* https://en.wikipedia.org/wiki/BMP_file_format#Bitmap_file_header */
else if(dataString.hasPrefix("BM"_s))
diff --git a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h
index d312b60a9..d13fe634b 100644
--- a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h
+++ b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h
@@ -57,6 +57,9 @@ Detects file type based on file extension or a signature at the start of the
file, loads corresponding plugin and then tries to open the file with it.
Supported formats:
+- Adaptive Scalable Texture Compression (`*.astc` or data with corresponding
+ signature), loaded with @ref AstcImporter or any other plugin that provides
+ it
- Basis Universal (`*.basis` or data with corresponding signature), loaded
with @ref BasisImporter or any other plugin that provides it
- Windows Bitmap (`*.bmp` or data with corresponding signature), loaded with
diff --git a/src/MagnumPlugins/AnyImageImporter/Test/8x8.astc b/src/MagnumPlugins/AnyImageImporter/Test/8x8.astc
new file mode 100644
index 000000000..e5d4d0fef
Binary files /dev/null and b/src/MagnumPlugins/AnyImageImporter/Test/8x8.astc differ
diff --git a/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp b/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp
index 6142d1270..cb5409e04 100644
--- a/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp
+++ b/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp
@@ -102,6 +102,8 @@ constexpr struct {
bool asData;
const char* plugin;
} DetectData[]{
+ {"ASTC", "8x8.astc", false, "AstcImporter"},
+ {"ASTC data", "8x8.astc", true, "AstcImporter"},
{"PNG", "rgb.png", false, "PngImporter"},
{"PNG data", "rgb.png", true, "PngImporter"},
{"JPEG", "gray.jpg", false, "JpegImporter"},
diff --git a/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt b/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt
index 0ca0f3e3f..aebfd7699 100644
--- a/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt
+++ b/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt
@@ -61,6 +61,8 @@ file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$/configure.h
corrade_add_test(AnyImageImporterTest AnyImageImporterTest.cpp
LIBRARIES MagnumTrade MagnumDebugTools
FILES
+ # From AstcImporter test data (in magnum-plugins)
+ 8x8.astc
# Generated by AnyImageConverterTest::propagateConfiguration2D()
depth32f-custom-channels.exr
# Generated by AnyImageConverterTest::convert{1D,3D}()