You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
684 B
Python
26 lines
684 B
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import os
|
|
import os.path
|
|
import tempfile
|
|
import dds
|
|
|
|
with tempfile.TemporaryDirectory(prefix="dds") as tempDir:
|
|
for argv in sys.argv[1:]:
|
|
print(f'[{argv}]: converting to dds')
|
|
file = os.path.abspath(argv)
|
|
tmpOutput = os.path.join(tempDir, os.path.basename(file))
|
|
output = os.path.splitext(file)[0] + ".dds"
|
|
|
|
alpha = dds.alpha(file)
|
|
dds.flip(file, tmpOutput)
|
|
|
|
print(alpha)
|
|
if alpha < 255:
|
|
format = "-bc3"
|
|
else:
|
|
format = "-bc1"
|
|
print(format)
|
|
dds.nvcompress(format, tmpOutput, output)
|
|
os.remove(file) |