Giter VIP home page Giter VIP logo

Comments (6)

walbourn avatar walbourn commented on August 21, 2024 2

Just download texconv.exe and use the command-line instructions.

If you want to convert TO the "DX10" FourCC, use the command-line switch -dx10.

from directxtex.

MattFiler avatar MattFiler commented on August 21, 2024

That's awesome, thanks!

from directxtex.

MattFiler avatar MattFiler commented on August 21, 2024

Just a quick follow-up question, I'm trying to call the exe in C# but I'm having real issues, could you take a look at this code to see what's wrong? Thanks!
Process.Start("texconv.exe", @"-dx10 -ft jpg -f BC7_UNORM -o \" + Path.GetDirectoryName(outFilePath) + @"\ " + outFilePath + ".dds");
Where "outFilePath" is a file name and folder location from the current directory.

from directxtex.

walbourn avatar walbourn commented on August 21, 2024

First, you are assuming that texconv.exe is in the 'current working directory'. You might want to use System.Diagnostics.ProcessStartInfo.

Second, you are telling the tool to write the result as a JPEG but are using BC7_UNORM which is not a form that JPEG can store. You should remove -ft jpg.

from directxtex.

MattFiler avatar MattFiler commented on August 21, 2024

Ah, I should have explained the context a bit better...

I've got my application and texconv.exe in a folder together, in my application I am exporting DDS files from a game with varying formats (including DXGI_FORMAT_BC7_UNORM and others). I want texconv.exe to convert the textures to .JPG as soon as they are exported so that I can allow the user to view them within my app, and the way I'm doing this is to export the DDS to the working directory, call the Process.Start command above, delete the DDS and then continue with the other files. I don't want the new JPG files to also be in the working directory though, they've got their own file structure which is why I'm trying to use -o to set the output directory.

The issue I'm having is that by pausing my loop after just one texture export and running a .bat file manually in the working directory I can export the textures fine, but running the same code through Process.Start (with my full loop and by pausing my loop) it just won't work and I've tried so many combinations I really can't figure out why. I can sometimes manage to get them to convert to JPG into the working directory, but using -o just seems to mess it all up (but only via the Process.Start). The .bat file I tested and the application that is running Process.Start are both in the same folder so I don't know why it would be a location-based issue.

To also explain my parameters, I'm inputting a DX10 BC7_UNORM texture in that example and trying to output it to JPG in its correct folder. I presumed you'd need the -f parameter for converting from DDS as well as to it?

Thanks!

from directxtex.

walbourn avatar walbourn commented on August 21, 2024

You don't control the input format with the command-line. It's whatever the source file contains. The switch controls the desired output format. Since you are trying to write a JPEG, you should use -ft jpg -f R8G8B8A8_UNORM.

Another option would be to use interop and write a little C++ wrapper that uses the DirectXTex library to do the conversion.

from directxtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.