Skip to main content

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).

Metadata

Release files for rwtextool 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rwtextool 1.0.0
File Size Uploaded
rwtextool-1.0.0.tar.gz 20.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rwtextool 1.0.0
File Interpreter ABI Platform
rwtextool-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.7 kB

Release files / rwtextool-1.0.0.tar.gz

Download URL rwtextool-1.0.0.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f09aeda8d9f5b0b04c3f7953bc9125293909ddcb4fe45869cd9f7a19f08eb508
BLAKE2b-256 checksum
How to use checksums
17633055565e1d63dff714458eff276c1915c6c7b995334173faefaadb3b15e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / rwtextool-1.0.0-py3-none-any.whl

Download URL rwtextool-1.0.0-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40a0728a70f3d3d182a1b5709d8fc2c45ce2db8b0b97d2ce074cf6673283e5d1
BLAKE2b-256 checksum
How to use checksums
cddfb39fb4d018badbc333885c90e200d912821c9c7a59ec4cb817d65734e295
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page