The VG Resource
how do i convert these 365 textures into png - Printable Version

+- The VG Resource (https://www.vg-resource.com)
+-- Forum: The Resources (https://www.vg-resource.com/forum-109.html)
+--- Forum: The Models Resource (https://www.vg-resource.com/forum-111.html)
+---- Forum: Ripping Help (https://www.vg-resource.com/forum-115.html)
+---- Thread: how do i convert these 365 textures into png (/thread-32602.html)



how do i convert these 365 textures into png - flashlight - 04-08-2018

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


RE: how do i convert these 365 textures into png - Friedslick6 - 04-08-2018

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)



RE: how do i convert these 365 textures into png - flashlight - 04-29-2018

nice ill try it later


RE: how do i convert these 365 textures into png - sutinoer - 04-29-2018

Here is a converter:
http://www.ddsconverter.com