Rework libpng Auxiliary support to address numerous problems (#636)

This commit is contained in:
Chuck Walbourn
2025-10-21 23:02:38 -07:00
committed by GitHub
parent 0b4d5f6541
commit 264931b2e1
6 changed files with 214 additions and 67 deletions

View File

@@ -622,7 +622,7 @@ namespace
#endif
#ifdef USE_LIBPNG
case CODEC_PNG:
return SaveToPNGFile(img, szOutputFile);
return SaveToPNGFile(img, PNG_FLAGS_NONE, szOutputFile);
#endif
default:
@@ -1434,7 +1434,9 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
#ifdef USE_LIBPNG
else if (_wcsicmp(ext.c_str(), L".png") == 0)
{
hr = LoadFromPNGFile(curpath.c_str(), &info, *image);
PNG_FLAGS pngFlags = (IsBGR(format)) ? PNG_FLAGS_BGR : PNG_FLAGS_NONE;
hr = LoadFromPNGFile(curpath.c_str(), pngFlags, &info, *image);
if (FAILED(hr))
{
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));