Skip to main content

Valve Texture Format Converter

Reason this release was yanked:

inaccurate license information

Project description

no_vtf

Say no to Source Engine's .vtf – convert it to one of the standard image formats.

Badge showing supported Python versions Badge showing package version on PyPI Badge showing number of monthly downloads from PyPI Badge showing source code repository hosted on SourceHut Badge showing builds.sr.ht status Badge showing REUSE compliance status Badge showing Nox as the chosen Python automation toolkit

Screencast showing conversion of sprays downloaded in Team Fortress 2 using no_vtf

Motivation

  • cross-platform – runs on any machine where Python is supported
  • console-only – runs without a graphical interface
  • full HDR support (including compressed HDR)
  • parallel conversion – uses all available resources to speed up the process
  • proper decoding of the ARGB8888 format
  • formally described .vtf file format (via Kaitai Struct)
  • regression suite against crafted .vtf files and reference output

Installation

Application bundle

For Linux and Windows running on x64, there are application bundles with the Python interpreter included.

./no_vtf ...  # Linux
no_vtf.exe ...  %= Windows =%

Bundles are ready to be used offline – the FreeImage library is already included.

Package

If you have Python 3.10 or newer, you can install the package from PyPI directly:

python3 -m pip install no_vtf

python3 -m no_vtf ...

Or install it into a virtual environment:

python3 -m venv no_vtf-venv

source no_vtf-venv/bin/activate  # Linux
no_vtf-venv/scripts/activate  %= Windows =%

no_vtf ...

Before the first conversion, the FreeImage library will be downloaded to support the process. Further conversions are supported offline.

Usage

General invocation

no_vtf [OPTIONS] PATH...

PATH can be either file or directory. Multiple paths may be provided.

Tip: With bundles, drag-and-drop files or folders to be converted onto the application launcher (the file with icon and no extension on Linux and the .exe file on Windows).

Change output directory

no_vtf --output-dir /tmp PATH...

Override LDR/HDR output format

no_vtf --ldr-format png --hdr-format tiff PATH...

Convert animated texture

no_vtf --animate --fps 20 PATH...

Further help

no_vtf --help

Supported formats

Input

All textures installed with Team Fortress 2, Source Filmmaker and Portal 2 can be converted with the supported format set.

  • RGBA8888
  • ABGR8888
  • RGB888
  • BGR888
  • I8
  • IA88
  • A8
  • RGB888_BLUESCREEN
  • BGR888_BLUESCREEN
  • ARGB8888
  • BGRA8888
  • DXT1
  • DXT3
  • DXT5
  • BGRA4444
  • DXT1_ONEBITALPHA
  • UV88
  • RGBA16161616F
  • RGBA16161616

Output

The following formats were tested and optimized for use:

LDR

  • PNG, APNG
  • TGA
  • TIFF (default)

HDR

  • EXR (default)
  • TIFF

It is also possible to select other formats supported by Imageio.

Known issues

Color space

Color space of LDR textures is inferred from the context in which the texture is used in-game. Since this context is not available when converting the .vtf files directly, color space metadata for the output images cannot be set.

Color space of HDR textures is always linear. It would make sense to set this metadata when converting into the TIFF format, but for technical reasons, this is not done.

Benchmark

  • Sample: 11 GiB of LDR .vtf files
  • CPU: Intel Core i7-6500U

Size is the total disk usage consumed by the output. Conversion was done without extraction of all mipmaps.

Compressed PNG, parallel

Time is the wall clock time.

  • 1 worker: 9.71 minutes
  • 2 workers: 5.45 minutes
  • 3 workers: 4.18 minutes
  • 4 workers: 3.77 minutes

Uncompressed, sequential

Time is the total CPU time spent in user and kernel mode.

  • PNG: 10.35 minutes
  • TGA: 2.69 minutes
  • TIFF: 3.27 minutes

In all three cases, the size was 33 GiB.

Compressed, sequential

Time is the total CPU time spent in user and kernel mode.

  • PNG: 5.9 GiB, 12.56 minutes
  • TGA: 14 GiB, 3.77 minutes
  • TIFF: 6.9 GiB, 8.81 minutes

Development

For more resources, check out the Nox sessions in noxfile.py and the build system in builds/.

Linting

python3 -m pip install nox

python3 -m nox -R
python3 -m nox -R -- --fix

Pre-build steps

# compile .ksy files (requires Kaitai Struct compiler)
# only necessary if a .ksy file was modified
ksy/compile.sh

License

The package is licensed under GNU LGPL v3.0 or later, except of image IO done with the help of the ImageIO FreeImage plugin. This makes the entire package effectively licensed under GNU GPL v3.0 or later. If you make use of the image IO part (either directly or indirectly) when linking to no_vtf as a library, the combined work is licensed under the latter 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

no_vtf-3.1.0.tar.gz (190.6 kB view details)

Uploaded Source

Built Distribution

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

no_vtf-3.1.0-py3-none-any.whl (55.1 kB view details)

Uploaded Python 3

File details

Details for the file no_vtf-3.1.0.tar.gz.

File metadata

  • Download URL: no_vtf-3.1.0.tar.gz
  • Upload date:
  • Size: 190.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12+

File hashes

Hashes for no_vtf-3.1.0.tar.gz
Algorithm Hash digest
SHA256 4b6d98fd88ef4dbb54cad7fc9eb213ab6112341ef41d2f909fd60902ad69a58c
MD5 dc78f8cc915554d06445f5c100e7502a
BLAKE2b-256 4d5e31063aa019cdb69c2400824abee1cbedaaf6aaf6b15532107ebd45038d8a

See more details on using hashes here.

File details

Details for the file no_vtf-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: no_vtf-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 55.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12+

File hashes

Hashes for no_vtf-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77ff4fb0115846ebb4f8f4742f1dbda98580e6ebbbeeca826a62de6d75d62399
MD5 d25703453176c141dd296a255640353a
BLAKE2b-256 392368bb8030eec03e8874cd4faa97c5e3a3809f51f0eff06ed2742c41b90e77

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