How can I use DirectXTex (C++) to open a dds texture, work with channels (invert, swap, etc.) and save simultaneously as a dds and tga file?
I wrote the first code, but for some reason it doesn't work (it doesn't save tga):
#include <DirectXTex.h>
using namespace DirectX;
int main()
{
    ScratchImage    image;
    TexMetadata     metadata;
    LoadFromDDSFile(L"texture.dds", DDS_FLAGS_NONE, &metadata, image);
    metadata            = image.GetMetadata();
    const Image*    img = image.GetImage(0, 0, 0);
    for (size_t i = 0; i < metadata.width * metadata.height; i++)
    {
        img->pixels[i * 4] = 255 - img->pixels[i * 4];
    }
    SaveToTGAFile(*img, L"texture.tga");
    return 0;
}
I set up the project in Visual Studio, the code compiles without errors or warnings.