had
had

Reputation: 327

Convert png to dds with python?

Need to convert 50 images, and doing it manually would be too long. Сan't find a library with such function.

I tried Pillow, but it can't save in dds.

Upvotes: 1

Views: 4742

Answers (4)

Tom Knudsen
Tom Knudsen

Reputation: 83

In regards to @Yuri Leonov post above. In Python3 I had to specify reading mode in open() command to get it to work.

from wand import image

with image.Image(filename=r'yourimage.png') as img:
    img.compression = 'dxt5'
    img.save(filename='yourimage.dds')

Upvotes: 0

Yuriy Leonov
Yuriy Leonov

Reputation: 494

You could use Wand library:

from wand import image

with image.Image(filename='your.png') as img:
    img.compression = 'dxt5'
    img.save(filename='your.dds')

Upvotes: 1

had
had

Reputation: 327

I found that I can use the command line app in python, so image magic covers all my needs.

Upvotes: 1

bicelot3
bicelot3

Reputation: 91

It appears that this library might be useful for you, check it out: https://github.com/ducakar/img2dds

Upvotes: 0

Related Questions