Is there anyone of you who knows if this question is maybe already answered.

All my textures in my .blend file are now .png is there any way i can change them from format with a little script to .dds so my export tool works correct for my game.

Thanks in advance

  • 1
    $\begingroup$ You would need to convert the files from png to dds fromat outside of blender; but you could write a script to find all of the png image files in your blend file and change the names to use the dds version. This exchange on BlenderArtist has an example of how to do it for a single image. $\endgroup$ Dec 30, 2021 at 21:48
  • $\begingroup$ Okay i already have all the textures set as .dds and they are all in a folder. but the textures linked to the objects are still .png and to change every texture manually from png>dds takes a lot off time so i whas wondering if there is a script what can do it for me quickly $\endgroup$
    – T1JNES
    Dec 30, 2021 at 22:08
  • $\begingroup$ Ok so i tested it and i still got an little bugg I added an video to make it more clear streamable.com/htlr87 $\endgroup$
    – T1JNES
    Jan 1, 2022 at 23:31

1 Answer 1


Assuming that you have all of your dds files in the same folder (directory) and each png file has a dds file that has the same name with png changed to dds, this script should do what you want once you've changed the line to point to your dds files.

import bpy

def find_nodes_by_type(material, node_type):
    """ Return a list of all of the nodes in the material
        that match the node type.
        Return an empty list if the material doesn't use
        nodes or doesn't have a tree.
    node_list = []
    if material.use_nodes and material.node_tree:
            for n in material.node_tree.nodes:
                if n.type == node_type:
    return node_list

path_to_dds_files = CHANGE_ME_TO_PATH_TO_DDS_FILES

for material in bpy.data.materials:
    texture_nodes = find_nodes_by_type(material, 'TEX_IMAGE')
    for texture in texture_nodes:
        if texture.image.name.endswith('.png'):
            new_name = texture.image.name.split(sep='.')[-2] + '.dds'
            new_image = bpy.data.images.load(filepath = path_to_dds_files + new_name)
            print(f"{material.name}: {texture.image.name}, {new_name}")
            texture.image = new_image
  • $\begingroup$ Thank you verry verry much $\endgroup$
    – T1JNES
    Dec 30, 2021 at 22:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .