Users browsing this thread: 1 Guest(s)
how do i convert these 365 textures into png
#1
i uploaded my inkopolis model but it was rejected because it had dds textures, how do you convert all 365 of these into png within blender and change the materials' sources as well
my sink is in trouble i need to call the super mario brotjers on the doiuble
Reply
Thanked by:
#2
Presuming you're running on Windows:
  • Install a copy of ImageMagick.
  • Save the following to a batch file (.BAT extension) in the directory containing the .DDS textures:
    Code:
    @CD /D %~dp0%
    @magick mogrify -format png *.dds
    @DEL *.dds
  • Run the batch file and wait for it to convert the .DDS textures into .PNG.
  • To optionally optimise each texture (reducing file size), download PNGOUT to the directory.
  • Save the following to another batch file in the directory containing the new .PNG textures::
    Code:
    @CD /D %~dp0%
    @FOR /R %%A IN (*.png) DO PNGOUT "%%A" "%%A" /y
  • Run the batch file and wait for it to optimise the .PNG textures.
File extensions can be fixed in post by find-and-replace on the exported plaintext model
Changing the extensions inside of Blender can be done automatically with the assistance of this Python script I found, credit to Photox.
Copy the following into the "scripting" layout's code window within Blender, then press the "Run" button below it:
Code:
import bpy

# the main looping code snippet is modified from
# https://blender.stackexchange.com/questions/80773/how-to-get-the-name-of-image-of-image-texture-with-python

print('----------------------------------------')
print('Starting the replacer script....')

texture_list = []
count_replaced_files = 0

find_chars = 'dds'
replace_chars = 'png'

for obj in bpy.context.scene.objects:
    for s in obj.material_slots:
        if s.material and s.material.use_nodes:
            for n in s.material.node_tree.nodes:
                if n.type == 'TEX_IMAGE':
                    texture_list += [n.image]
                    #print(obj.name,'uses',n.image.name,'saved at',n.image.filepath)
                    if find_chars in n.image.name:
                        count_replaced_files += 1
                        old_name = n.image.name
                        new_name = n.image.name
                        new_name = new_name.replace(find_chars,replace_chars)
                        n.image.name = new_name
                        info_string = old_name + ' has been replaced with ' + new_name
                        print(info_string)
                        
print(str(count_replaced_files))
print('File were replaced')
print('Finished')
print('----------------------------------------')

#print(texture_list)
Reply
Thanked by:
#3
nice ill try it later
my sink is in trouble i need to call the super mario brotjers on the doiuble
Reply
Thanked by:
#4
Here is a converter:
http://www.ddsconverter.com
Reply
Thanked by:


Forum Jump: