mirror of
https://github.com/microsoft/DirectXTex.git
synced 2026-02-04 04:16:12 +01:00
Add support for HEIF and WEBP to command-line tools (#268)
This commit is contained in:
@@ -709,9 +709,8 @@ namespace
|
||||
swprintf_s(desc, L": %ls", errorText);
|
||||
|
||||
size_t len = wcslen(desc);
|
||||
if (len >= 2)
|
||||
if (len >= 1)
|
||||
{
|
||||
desc[len - 2] = 0;
|
||||
desc[len - 1] = 0;
|
||||
}
|
||||
|
||||
@@ -792,7 +791,14 @@ namespace
|
||||
#endif
|
||||
|
||||
default:
|
||||
return SaveToWICFile(img, WIC_FLAGS_NONE, GetWICCodec(static_cast<WICCodecs>(fileType)), szOutputFile);
|
||||
{
|
||||
HRESULT hr = SaveToWICFile(img, WIC_FLAGS_NONE, GetWICCodec(static_cast<WICCodecs>(fileType)), szOutputFile);
|
||||
if ((hr == static_cast<HRESULT>(0xc00d5212) /* MF_E_TOPO_CODEC_NOT_FOUND */) && (fileType == WIC_CODEC_HEIF))
|
||||
{
|
||||
wprintf(L"\nINFO: This format requires installing the HEIF Image Extensions - https://aka.ms/heif\n");
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1477,6 +1483,17 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
if (hr == static_cast<HRESULT>(0xc00d5212) /* MF_E_TOPO_CODEC_NOT_FOUND */)
|
||||
{
|
||||
if (_wcsicmp(ext, L".heic") == 0 || _wcsicmp(ext, L".heif") == 0)
|
||||
{
|
||||
wprintf(L"INFO: This format requires installing the HEIF Image Extensions - https://aka.ms/heif\n");
|
||||
}
|
||||
else if (_wcsicmp(ext, L".webp") == 0)
|
||||
{
|
||||
wprintf(L"INFO: This format requires installing the WEBP Image Extensions - https://www.microsoft.com/p/webp-image-extensions/9pg2dk419drg\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user