PIL and DDS

Anyone know of any plugins for PIL that handle DDS image files… I had a browse about and found something offered up by the WOW guys but nothing official from PIL, it seems odd that its not supported considering the increase in python usage across the industry.

Writing my own is a bit beyond my python skills currently.

Of Interest WOW’s dds Ui texture stuff for Python PIL:
http://nullege.com/codes/show/src@p@i@pilgrim-HEAD@pilgrim@[email protected]/121/PIL.ImageFile.ImageFile.fromstring

I can’t get it working but maybe some one can helpout and find use for it?

Okay so with a little hacking about I can at least get it to read the file dimensions.
So its reading data from the header file.

Hello there,

I’ve registered so I could follow up on this,

I managed to get the nullege example working and open .dds using pil now ( thanks for the nullege link!)

However I’m in desperate need for a .dds python encoder, strangely enough it seems really hard to find on google.

I was wondering if you knew the name of the author of this, is it the same Pilgrim who wrote Dive into Python? :

http://nullege.com/codes/show/src%40p%40i%40pilgrim-HEAD%40pilgrim%40codecs%40__init__.py/9/dds.DDS/python

THanks a lot for your help
Luca

There’s a dds converter available from nvidia that you should be able to use from the commandline. That would probably be easier to use.

DevIL also supports DDS reading and writing:

DevIL Features

I’ve heard tell of people generating python bindings pretty easily, but i don’t know the details…

thanks I’ll use the nvidia command tool for now, however I’d rather keep the program contained in a simple python file rather than wrapping an executable :frowning:

L

Wrapping nvdxt with python turns out to be really easy. Reimplementing the functionality of nvdxt.exe will probably be a lot of work.

nvdxt comes with the legacy texture tools pack from nvidia.

Recently I needed to load .DDS and .HDR in a python application that i am writing, I used ctypes to load FreeImage. I just need to read the files so I went with FreeImage, You should be able to use ctypes and load DevIL to use its functions. Have a look at FreeImagepy which is a wrapper using ctypes to FreeImage.