D3DXSaveSurfaceToFile PNG format broken in Apr 06 SDK?

I've been using D3DXSaveSurfaceToFile for screenies for a while. Saving to .PNG format produces only solid white images since we've updated to Apr 06 SDK. Full debug output (including compiling with D3D_DEBUG_INFO) gives no errors. Anyone else hear of any problems with this specific format



Answer this question

D3DXSaveSurfaceToFile PNG format broken in Apr 06 SDK?

  • m.schlestein

    Hi,

    Can you repro this issue using texconv For instance, say you have texture in a bmp file: imagefile.bmp. Then you can do the following:
    texconv imagefile.bmp -ft png

    Does the imagefile.png file contain what it should If not please send both files to directx@microsoft.com. If you have further issues, would you provide enough details for us to reproduce the issue so we can debug it

    Thanks,
    Ben


  • NickChadwick

    Hi Ben,


    The texconv command worked fine, converted to png with no problems. I sent you an email with a tiny test routine which demonstrates the problem.


    Thanks
    Joe


  • tosun

    Hi Joe,

    I've looked into your issue and have found that alpha channel == 0.0 for the pixels in the front buffer. We used to ignore the alpha channel b/c some content tools exported alpha == 0.0 for pngs, but now we use it if it's there. You can do a LoadSurfaceFromSurface() to an X8R8G8B8 surface to make your files like they were before.

    Ben


  • Yevgeniy K

    Hi Joe,

    I'm still waiting for the email to percolate through the system to me. When it does I'll post a followup here.

    Thanks for the repro,

    Ben


  • mentally_disturbed

    Thanks Ben. I had to use a similar trick to "repair" BMP output from SaveSurfaceToFile, as it was writing 32-bit BMPs, which alot of paint programs do not like.


  • D3DXSaveSurfaceToFile PNG format broken in Apr 06 SDK?