Skip to main content

KTEX texture packer + converter for Rotwood

Project description

Rotwood TEX Tool

KTEX texture packer + converter for Rotwood.

Installation

Requirements:

  • Python 3.12+
  • ImageMagick

Windows

Install dependencies

  • Python (Check "Add python.exe to PATH")
  • ImageMagick ("Windows Binary Release" .exe installer)

Install rwtextool

  • From PyPI (recommended):
    1. Open a terminal window
    2. Run pip install rwtextool
  • From source repo:
    1. Download repo ZIP or git clone (if you have Git)
    2. Open terminal widnow in rwtextool directory
    3. Run pip install .

Now you can use tex2img and img2tex system-wide, see Usage for more details.

Linux

Install dependencies

# Debian
sudo apt install git imagemagick python3
sudo apt install python3-venv  # for venv
sudo apt install python3-pip  # for global pip

# Arch Linux
sudo pacman -S git imagemagick python
sudo pacman -S python-pip  # for global pip

# Fedora
sudo dnf install git ImageMagick python3
sudo dnf install python3-pip  # for global pip

Install from PyPI

pip install rwtextool

Install from source

[!NOTE] The commands used below might differ a bit depending on your platform/Linux distro, sometimes it will be python, sometimes it's python3.

git clone https://codeberg.org/gibbert/rwtextool
cd rwtextool

# virtual environment
	python3 -m venv .venv
	source .venv/bin/activate
	pip install .

# install system-wide (not recommended)
	sudo pip install --break-system-packages .

Nix flake

This repo includes a Nix flake that provides a package under packages."x86_64".default.

There are 2 executables, tex2img and img2tex.

With nix run (uses tex2img by default)

nix run "git+https://codeberg.org/gibbert/rwtextool" -- --help

With nix shell

nix shell "git+https://codeberg.org/gibbert/rwtextool"
tex2img --help
img2tex --help

Example Nix flake input:

nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

rwtextool = {
	url = "git+https://codeberg.org/gibbert/rwtextool";
	inputs.nixpkgs.follows = "nixpkgs";
};

For outputs I have specialArgs = { inherit inputs; };

In modules:

{ pkgs, inputs, ... }: {
	environment.systemPackages = [
		inputs.rwtextool.packages.${pkgs.stdenv.hostPlatform.system}.default
	];
}

Usage

Extract image from tex files

tex2img --auto-atlas ui_ftf_power_icons1.tex

Pack folder of textures

img2tex directory/path

More detailed --help info

Unpacking TEX+XML to PNGs

usage: tex2img [-h] [-A] [-a ATLAS_PATH] [-v] tex_path

Unpacks a Rotwood Klei TEX file (and XML atlas) to PNG images.

positional arguments:
  tex_path              TEX texture file

options:
  -h, --help            show this help message and exit
  -A, --auto-atlas      Automatically find and use the XML atlas matching the
                        texture file name
  -a, --atlas ATLAS_PATH
                        XML atlas file, the result unpacked images will be
                        placed in a new directory
  -v, --verbose         Output verbosity level (can stack) (warnings, info,
                        all info)

Packing PNGs into TEX+XML

usage: img2tex [-h] [-v] source_path

  Packs a directory of PNG images into Rotwood Klei TEX textures and atlases.

  positional arguments:
    source_path    Directory of PNG files

  options:
    -h, --help     show this help message and exit
    -v, --verbose  Output verbosity level (can stack) (warnings, info, all info)

License

This project uses the GPL 3 or later license (see LICENSE).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rwtextool-1.0.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rwtextool-1.0.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file rwtextool-1.0.0.tar.gz.

File metadata

  • Download URL: rwtextool-1.0.0.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for rwtextool-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f09aeda8d9f5b0b04c3f7953bc9125293909ddcb4fe45869cd9f7a19f08eb508
MD5 5b81d8374d00608da6991404c9a5140a
BLAKE2b-256 17633055565e1d63dff714458eff276c1915c6c7b995334173faefaadb3b15e0

See more details on using hashes here.

File details

Details for the file rwtextool-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: rwtextool-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for rwtextool-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40a0728a70f3d3d182a1b5709d8fc2c45ce2db8b0b97d2ce074cf6673283e5d1
MD5 bad2808da8340bb51a9af88779e603c4
BLAKE2b-256 cddfb39fb4d018badbc333885c90e200d912821c9c7a59ec4cb817d65734e295

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page