February 27, 2010

save a .DDS from Photoshop

I am particular to command line tools and Nvidia offers us a nice and simple tool for .DDS compression.
Its super fast and runs on the GPU through CUDA (although that means you need the proper hardware and drivers)

nvcompress.exe is the particular tool I’m looking at here but there are a few other cool utilities included too.

You can get direct and simple access to the tool through Photoshop by running some simple scripts.

Some Examples:
for color > DXT5:  DDS_DXT5_c.js
for normals > DXT5:  DDS_DXT5_n.js

How to Install:
put the *.js files here /Adobe Photoshop CS*/Presets/Scripts
run from File > Scripts menu
(you must have nvcompress.exe’s filepath in your PATH Environment Variable or this wont work out of the box)

How it Works:
It saves a temporary copy of the currently selected Photoshop document to a .tga
It creates temporary .bat script containing the command line arguments for nvcompress.exe
Runs the .bat script on the temporary .tga and spits out a new file into the same folder as your original document (with the ‘filename’_DXT5.dds naming convention)

These scripts are very easy to edit, and can be made to run multiple compressions in sequence.

Documentation and command line arguments are available here:

Take it – run with it.

Special thanks to Fredrik Brännbacka who posted Save As Map.js on CGTalk a few years ago – from which this script is directly based.

No comments:

Post a Comment