Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.dds create for mod
#1
im way new to python as an FYI (u can tell from the GUI Blush )

i built a script that creates a set of .dds images for a game (world of tanks) as custom marks of excellence.
the script works apart from it creates the wrong type of .dds and i can not figure out how to correct it.

from a working .dds file (working as in works in game)
DDS file, no DXT10 extension.
Extent: 256 x 256 x 1 px
DXGI format: BC3_UNORM_SRGB (78)
Mips: 9
Array elements: 1
Cubemap: false
Alpha mode: Straight

my created .dds
DDS file, no DXT10 extension.
Extent: 256 x 256 x 1 px
Format: Bitmasked
RGB bit count: 32
Red bitmask: 0xff0000
Green bitmask: 0xff00
Blue bitmask: 0xff
Alpha bitmask: 0xff000000
Bytes per scanline: 1024
Is YUV: false
Is luminance: false
Has alpha: true
Has RGB: true
Is Bump DuDv: false
Mips: 1
Array elements: 1
Cubemap: false
Alpha mode: Straight

as far as i can tell im asking for the correct format

        for nation in nations:
            for i in range(1, 4):
                img = self.create_image(i)  # Create the image
                
                # Apply distress effects before saving
                if self.apply_dirt_effect.get():
                    img = self.apply_dirted_effect(img)
                if self.apply_wear_effect_var.get():
                    img = self.apply_wear_effect(img)

                img = img.convert("RGBA")  # Ensure the image is in RGBA format

                dds_filename = f"gun_{nation}_{i}.dds"
                dds_path = os.path.join(output_dir, dds_filename)

                try:
                    img.save(dds_path, format='DDS', compression='DXT5', options={'DXGI_FORMAT': 'BC3_UNORM_SRGB'})

                    print(f"Saved: {dds_path}")
                except Exception as e:
                    print(f"Error saving {dds_filename}: {e}")

        self.compress_to_wotmod(output_dir, base_file_name)
ive attached my full .py and 2 .dds files. works.dds well works, created.dds is what my script creates.

im at a loss as im new to python.

hugethanks for any help.

Attached Files

.py   main.py (Size: 21.83 KB / Downloads: 99)
.zip   dds-files.zip (Size: 3.31 KB / Downloads: 108)
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020