From b8527ec3af4ce6a892ed5b763311944668d9925b Mon Sep 17 00:00:00 2001 From: UnitedAirforce Date: Sat, 1 Feb 2025 10:58:12 +0800 Subject: [PATCH] Added dds tool --- various-tools/dds to python/3.py | 18 ++++++++++++++++++ various-tools/dds to python/readme.txt | 1 + 2 files changed, 19 insertions(+) create mode 100644 various-tools/dds to python/3.py create mode 100644 various-tools/dds to python/readme.txt diff --git a/various-tools/dds to python/3.py b/various-tools/dds to python/3.py new file mode 100644 index 0000000..b5a6239 --- /dev/null +++ b/various-tools/dds to python/3.py @@ -0,0 +1,18 @@ +import os +import imageio.v3 as iio + +output_dir = os.path.join(os.getcwd(), "output") +os.makedirs(output_dir, exist_ok=True) + +for filename in os.listdir(os.getcwd()): + file_path = os.path.join(os.getcwd(), filename) + + if filename.lower().endswith(".dds") and os.path.isfile(file_path): + try: + img = iio.imread(file_path) + new_filename = os.path.splitext(filename)[0] + ".png" + new_file_path = os.path.join(output_dir, new_filename) + iio.imwrite(new_file_path, img, extension=".png") + print(f"Converted: {filename} -> {new_filename}") + except Exception as e: + print(f"Error converting {filename}: {e}") diff --git a/various-tools/dds to python/readme.txt b/various-tools/dds to python/readme.txt new file mode 100644 index 0000000..914719b --- /dev/null +++ b/various-tools/dds to python/readme.txt @@ -0,0 +1 @@ +This converts all dds under its directory to "output/...png". \ No newline at end of file