D
D
Degit2015-10-31 21:08:39
Python
Degit, 2015-10-31 21:08:39

How to load DDS file in Python 3?

Need to convert and convert DDS (DirectDraw Surface) to PNG using Python 3. Is there any module? Pillow can't open. OSError: cannot identify image file 'filename.dds'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nirvimel, 2015-10-31
@Degit

Recently angru gave me some pyglet to study during the discussion of my question . In the process of slowly absorbing the documentation, among other things that were not particularly interesting to me, the pyglet.image.codecs.dds module with the DDSImageDecoder class flashed by.
For 30 sec. on my knee, I wrote the following code (it will be a miracle if it works):

from pyglet.image.codecs.dds import DDSImageDecoder.
from pyglet.image import load
image = load('one_file.dds', decoder=DDSImageDecoder())
image.save('another_file.png')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question