Skip to main content

Valve Texture Format Converter

Project description

no_vtf

Say no to .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 compliance with OpenSSF Best Practices Badge showing Nox as the chosen Python automation toolkit

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


⌂ Project pages   # Source code   ~ Changelog   > Mailing list   + Ticket tracker   ❡ Wiki  


Highlights

  • 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 (VTFLib/VTFEdit handles the format incorrectly)
  • formally described .vtf file format (via Kaitai Struct)
  • test suite against crafted .vtf files and reference output
  • desktop environment integration via no_vtf-desktop (Linux-only)

Installation

Application bundle

For Linux and Windows running on x64, application bundles (with the Python interpreter included) are available for download. Below are links to the latest stable version.

Starting from v4.2.0, application bundles GPG-signed with 0x1C3724DFF9CEAF64 are also attached to the tagged versions.

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 no_vtf package from PyPI directly. An optional desktop integration is available via the no_vtf-desktop package.

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

As of PEP 668, it is recommended to install the package into a virtual environment.

Automated installation (via pipx)

pipx install no_vtf

no_vtf ...

Manual installation

python3 -m venv no_vtf-venv

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

python3 -m pip install no_vtf

no_vtf ...

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

Set FPS for animated textures

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

LDR-only VTF2TGA-like conversion

no_vtf --no-animate --ldr-format tga --hdr-format skip PATH...

Further help

no_vtf --help

Supported formats

Input

Official VTF versions (7.0-7.5)

All image formats that are stable across Source Engine branches are supported. It should be possible to convert all textures installed with games based on a first-party Source Engine branch, such as Team Fortress 2, Source Filmmaker and Portal 2.

  • RGBA8888
  • ABGR8888
  • RGB888
  • BGR888
  • RGB565
  • I8
  • IA88
  • A8
  • RGB888_BLUESCREEN
  • BGR888_BLUESCREEN
  • ARGB8888
  • BGRA8888
  • DXT1
  • DXT3
  • DXT5
  • BGRX8888
  • BGR565
  • BGRX5551
  • BGRA4444
  • DXT1_ONEBITALPHA
  • BGRA5551
  • UV88
  • UVWQ8888
  • RGBA16161616F
  • RGBA16161616
  • UVLX8888

The following additional formats in Strata Source are supported.

  • ATI2N
  • ATI1N
  • BC7

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.

Compatibility

R/G/B/A value differences

For the compressed formats (such as DXT) and for the less precise formats (such as RGB565), the output R/G/B/A values might not match bit-for-bit. This is typically due to rounding differences or different methods used to calculate the lower bits during decoding.

Alpha handling

A permissive approach is used when handling alpha channels. If alpha is physically present in the encoded data, it is included in the output when either the format or flags (onebitalpha/eightbitalpha) indicate its validity. This applies to the DXT1 format and formats having the fourth 'X' channel (BGRX8888, BGRX5551, UVLX8888), where alpha would otherwise be ignored if no alpha flag were set.

Animated output

Image frames in the output file might not be stored exactly as they appear in the original .vtf file. For instance, consecutive identical frames might be merged into a single frame with a longer duration.

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

Contributing / Getting help

Please refer to CONTRIBUTING.md.

License

This package is free and open-source software, 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 only. 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-5.1.2.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

no_vtf-5.1.2-py3-none-any.whl (77.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: no_vtf-5.1.2.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20+

File hashes

Hashes for no_vtf-5.1.2.tar.gz
Algorithm Hash digest
SHA256 862543620842c924c13ea18f98211f2c635f0de04cb335540f9e5d3c731c2edd
MD5 f513de523f6a8028dbcacd465eac46ca
BLAKE2b-256 a4fac17bb9cc70379a780133a9576e9746b9b344c9bd29317fafd485e41873c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: no_vtf-5.1.2-py3-none-any.whl
  • Upload date:
  • Size: 77.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20+

File hashes

Hashes for no_vtf-5.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 efc0f6a152f7594f41b4e7f5d11add309b2950274860abb070f70bb8e39d3c44
MD5 7142a22eea3ad95c691bfe5693466933
BLAKE2b-256 607a16fb303068117fd41573cde9346104971dcdf589dcf102df9d56adac0298

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