Skip to content

Instantly share code, notes, and snippets.

@Metriximor
Created January 20, 2023 15:26
Show Gist options
  • Save Metriximor/071ea57ced5d24e55683f49f82836126 to your computer and use it in GitHub Desktop.
Save Metriximor/071ea57ced5d24e55683f49f82836126 to your computer and use it in GitHub Desktop.
Converts png files into dds file format
import glob
from wand.image import Image
from pathlib import Path
root_dir = "./"
for png_image in glob.iglob(root_dir + "gfx/interface/**/*.png", recursive=True) and glob.iglob(root_dir + "gfx/coat_of_arms/**/*.png") and glob.iglob(root_dir + "gfx/models/**/*.png"):
with Image(filename=png_image) as open_image:
print(f"Converting {png_image} to .dds from .png")
open_image.compression='dxt5'
path = Path(png_image)
open_image.save(filename=path.with_suffix('.dds'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment