texconv png conversion

Dec 5, 2013 at 1:55 PM

I just downloaded texconv today and wanted to convert a PNG thats in B8R8G8A8_UNORM format into R8G8B8_UNORM format. when I run the texconv I use the following:

texconv.exe -sx 1 -ft png -f R8G8B8A8_UNORM normal.png

The output results in :
  • reading normal.png (512x512 B8G8R8A8_UNORM 2D) as (512x512 R8G8B8A8_UNORM 2D)
  • writing normal1.PNG
Which makes it seem like it did what was expected. However, if I look at the newly generated normal1.png it actually ends up being in B8G8R8A8_UNORM_SRGB format. So it didn't convert from BGR to RGB, but instead left it in BGR with SRGB. If I export to DDS then it seems to work OK, but right now I need PNGs.

Any ideas how to make this convert to basic RGB UNORM ordering format with PNG output?

Dec 5, 2013 at 8:00 PM
The choice of output format is basically up to WIC, so the PNG encoder uses BGRA (GUID_WICPixelFormat32bppBGRA) instead of RGBA (see MSDN). That part is therefore expected behavior.

The "_SRGB" part comes from the 'sRGB' tag which is handled as WIC metadata. I only explicitly set the sRGB tag if the input format was "_SRGB". I can look into this aspect of your report. Can you attached your normal.png?
Marked as answer by walbourn on 1/23/2014 at 11:21 PM