Need a batch-able, command line texture processing tool TIF -> DDS

I need a batch-able tool that can take 4 layered 1024 tiffs:
diffuse.tif (24bit)
emissive.tif (8bit grayscale)
normal.tif (24bit)
specular.tif (8bit grayscale)

and perform the following via command line options:

resize (to vairious dimensions) pref. using Lancozs filter and some sharpening
add emissive to diffuse as alpha channel
add specular to normal as alpha channel
save as DDS / dxt5 , no mips.

my preliminary research (google) shows that not any one tool does all of the things.
any suggestions?

best off using a image library like PIL or the PS api to compose the tiff files with the structure you mentioned, than call the tiff to dds converter separately.

I believe you can batch through xnview or ifranview (though not sure how much of it is exposed) which has support for resizing with lancozs filter and then do the rest with photoshop script.

PIL apparently does lanzcos filter with Image.ANTIALIAS from reading some python mail threads though havent played around with it much.

Is speed an issue? If it’s not, I’d do the image processing in Photoshop and compress with a command line toole like http://developer.amd.com/resources/archive/archived-tools/gpu-tools-archive/the-compressonator/

If it is, you might want to look at using libtiff Read and write TIFF images in C# and VB.NET | LibTiff.Net for the processing and http://managedsquish.codeplex.com/releases/view/92261 for the compression in c#

working with xnview at the moment, it may work form me. Unfortunately the DDS format offers no options in that tool.

@theodox: Not speed but iteration with various size and compression settings is what I am after. Is Photoshop drive-able via command line ? i haven’t scripted photoshop yet (tho I’ve done a ton of Flash JSFL)…

ImageMagick is another popular option.

And I mention this mainly for laughs, but I’ve used Image Alchemy for nearly 20 years. I don’t know how often it’s updated, but they do have a working website.

I suspect the latter does not support DDS, however.

ya photoshop is drivable from pretty much any programming language that can can access a com interface, i have had great success scripting photoshop from python. Than from there it is pretty easy to fire up photoshop from a python script, and do pretty much anything you want with it once it is fired up. i Can post a sample tomorrow for you of this too if you would like.

nconvert (the xnview command line tool) looks like it cannot composite a separate image into an alpha channel, just a straight 0-255 value.
xnconvert (the xnview GUI tool) cannot specify different alpha channels on a per-image basis in a batch.
too bad :frowning:

I’ll look at imageMagick next. Failing that, I’ll have to dive into the C# / .Net libraries Theodox shared.

Thanks all for your responses.

ImageMagick turns out to be extremely powerful, but it won’t compress to Dxt / dds. It can do all the other things however.

The plan is to use ImageMagick to generate temp images and then pass those to Nvidia’s nvcompress or AMD’s TheCompressonator to convert to DDS.

So I want to solicit advice on 2 points:

1.) since source images ( multilayered 64 bit TIFFs need )to be flattened and crunched to 32 bit before dds conversion,
What format should the 32 bit temp files be? ( currently using .tga )

2.) has anyone used both Nvidia’s nvcompress and AMD’s ATI’s TheCompressonator , and developed a preference?
I am wondering if there is an advantage to one over the other.

You could also check djv_convert, one of the tools of the http://djv.sourceforge.net/ project. Its made for sequences but it sure can handle single files.

A script I made spawns multiple djv_convert subprocesses to speed up conversion when processing large sequences.

  1. Why not keep them as TIFF? I heard TGA is soon to be an unsupported format
  2. We used both and the artists liked the AMD results better. Though I forget exactly why :confused:

TheMaxx:
1.) good point , i thought tiffs were creating problems but I think I was just not properly flattening them in imageMagick
1.) layered Tiff files, it turns out , do not correctly flatten and resize via imageMagick ]
-at least not with the commandlines I am using. the bottom layer resizes, all other layers just crop.
I could research the issue and find a possible solution…or I can stick with converting to TGA which does the trick.
2.) I’ve been going with theCompresionator for now. The syntax was a little more obscure

the issue I’m bumping up against now is that some of our source files are .psd and others are .tif.
and imageMagick doesn’t properly handle psd layers.
I may just use adobe bridge to start a batch conversion as I leave tonight…

Interestingly enough, .dds support is being added to imagemagick…
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=23946&p=102574#p102574

Have you tried OIIO? The command line utility oiiotool or the Python API might work for you.

-K