#put in same folder as texconv.exe #https://github.com/microsoft/DirectXTex/wiki/Texconv import os import subprocess # Set the output directory output_dir = 'images/insignia' # Create the output directory if it doesn't exist if not os.path.exists(output_dir): os.makedirs(output_dir) # Iterate over all PNG files in the current directory for filename in os.listdir('.'): if filename.endswith('.png'): # Prepare the command to convert PNG to BC3 DXT5 with mipmaps input_file = filename output_file = os.path.join(output_dir, f'{os.path.splitext(filename)[0]}.dds') # Command to run Texconv command = [ 'Texconv.exe', # Change this to the path if Texconv.exe is not in the same folder '-f', 'dxt5', # Set compression format: DXT5 (BC3, for RGBA images) '-m', '9', # Generate 9 levels of mipmaps '-o', output_dir, # Output directory '--separate-alpha', #separate alpha input_file # Input file ] # Run the command print(f'Converting {input_file} to {output_file}...') subprocess.run(command) print('Conversion completed!')