Help:Nope: Difference between revisions

From Total War Modding
Line 16: Line 16:
'''''Note that you can adapt tools and methods based on your preferences and expertise.''
'''''Note that you can adapt tools and methods based on your preferences and expertise.''
'''
'''
==== Required software ====


Bellow are the required tools and their configuration:
Bellow are the required tools and their configuration:
Line 26: Line 28:
# [https://github.com/Frodo45127/rpfm RPFM] or [https://tw-modding.com/wiki/Tutorial:AssetEditor AssetEditor]
# [https://github.com/Frodo45127/rpfm RPFM] or [https://tw-modding.com/wiki/Tutorial:AssetEditor AssetEditor]
# [https://www.python.org/downloads/ Python]: Any form will suffice, I personally use the Python binary built-in Ubuntu WSL
# [https://www.python.org/downloads/ Python]: Any form will suffice, I personally use the Python binary built-in Ubuntu WSL
==== Software configuration & plugins ====
* ''Gimp batch processing plugin''
Later on, we will need to convert DDS textures to PNG to allow Upscayl to work its magic. Therefore, we'll utilize a custom Python-fu plugin to perform batch texture conversion instead of doing it manually.
{| class="mw-collapsible mw-collapsed wikitable"
|+ style=white-space:nowrap | The caption remains visible.
|-
! Text !! More text
|-
| This  content || is hidden
|-
| at first || load time
|}
{{Codesample |name=dds_to_png.py |lang=python|scheme=dark |line=1 |highlight=5,8 |code=
from gimpfu import *
def batch_dds_to_png(directory):
    import os
    pdb.gimp_message("Processing directory: " + directory)
    # Find all DDS files in the directory
    filelist = [f for f in os.listdir(directory) if f.lower().endswith('.dds')]
    pdb.gimp_message("List of files to convert: " + ", ".join(filelist))
    if len(filelist) == 0:
        pdb.gimp_message("No DDS files found in the specified directory.")
        return
    pdb.gimp_message("Initiating batch conversion from DDS to PNG...")
    for filename in filelist:
        filepath = os.path.join(directory, filename)
        pdb.gimp_message("Currently converting: " + filename)
        # Open the DDS file
        image = pdb.file_dds_load(filepath, filepath, 1, 0)
        # Get the active layer
        drawable = pdb.gimp_image_get_active_layer(image)
        # Save as PNG
        png_filepath = os.path.join(directory, os.path.splitext(filename)[0] + '.png')
        pdb.file_png_save_defaults(image, drawable, png_filepath, png_filepath)
        # Delete the image to free memory
        pdb.gimp_image_delete(image)
    pdb.gimp_message("Batch conversion completed.")
register(
    "python-fu-batch-dds-to-png",
    "Batch DDS to PNG",
    "Convert all DDS files in a directory to PNG",
    "Toumai",
    "Toumai",
    "2023",
    "Batch DDS to PNG...",
    "",
    [
        (PF_DIRNAME, "directory", "Directory", "")
    ],
    [],
    batch_dds_to_png,
    menu="<Image>/File/Batch/"
)
main()
}}
* ''AutoHotKey script''
xxxx

Revision as of 06:32, 11 October 2023

What is this about ?

In this article, we will explore a method for upscaling game textures using AI. This process can be partially automated, enabling batch processing of textures.


Warhammer3 2023-10-08 16-08-18.png


Setting up the work environment

Before proceeding, it's essential to set up the correct environment with all the necessary tools and configurations.

Note that you can adapt tools and methods based on your preferences and expertise.

Required software

Bellow are the required tools and their configuration:

  1. Ubuntu WSL
  2. Gimp
  3. Paint.Net
  4. AutoHotKey
  5. Upscayl
  6. RPFM or AssetEditor
  7. Python: Any form will suffice, I personally use the Python binary built-in Ubuntu WSL


Software configuration & plugins

  • Gimp batch processing plugin

Later on, we will need to convert DDS textures to PNG to allow Upscayl to work its magic. Therefore, we'll utilize a custom Python-fu plugin to perform batch texture conversion instead of doing it manually.

The caption remains visible.
Text More text
This content is hidden
at first load time

Template:Codesample


  • AutoHotKey script

xxxx