Skip to main content

A library to convert Valve Texture Format (VTF) files into images

Project description

vtf2img

A Python library to convert Valve Texture Format (VTF) files to images.

Installation

With pip

$ pip install vtf2img

From source

$ git clone https://github.com/julienc91/vtf2img
$ cd vtf2img
$ python setup.py install

QuickStart

As a library

from vtf2img import Parser


vtf_file = "materials/models/weapons/customization/paints/custom/workshop/ak47_asiimov.vtf"

parser = Parser(vtf_file)
header = parser.header

print(f"VTF version: {header.version}, Image size: {header.width}x{header.height}")
# VTF version: 7.5, Image size: 2048x2048

image = parser.get_image()

image.show()
image.save("ak47_asiimov.png")

The result of get_image is an instance of Pillow's Image class, which allows exporting in many different formats (PNG, JPG, BMP, ...).

As a CLI command

If you installed the package as instructed in the previous section, a vtf2img command should be available.

$ vtf2img dragon_awp.wtf awp_dragon_lore.png

Otherwise, you can execute the package's __main__.py file with:

$ python -m vtf2img dragon_awp.wtf awp_dragon_lore.png

Limitations

  • many image formats supported by the VTF format are not (yet?) supported by this program (see the section below)
  • this program only considers the hi-res image contained in the VTF file
  • all the flags that might have been set by the VTF's creator are purely ignored

VTF compatibility

Works with VTF version 7.2+.

Compatibility of image formats:

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

Most VTF Files are using either DXT1 or DXT5.

Note: DXT1 and DXT5 decoding algorithms were adapted from Harry Jeffery's implementation on vtf2png.

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

vtf2img-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

vtf2img-0.1.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file vtf2img-0.1.0.tar.gz.

File metadata

  • Download URL: vtf2img-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for vtf2img-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6265acf3aef777bdb01f89d33973f80051acda0ac8113967e2cd4c0f93df1340
MD5 2a059c1128b0418a51c6eb6e98818bd5
BLAKE2b-256 b03b848fe1785a358c7e9605e4d11043f9261411a876754705308f835557f75c

See more details on using hashes here.

File details

Details for the file vtf2img-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vtf2img-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for vtf2img-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 422d5888cf434e30179f0a2068423f1456b4dff2d78a96163afaf2b25195e492
MD5 0f9e544027b8394728cedbed8adaf4f5
BLAKE2b-256 78048248534c3b357e0aaceae5b7728ff49e2244bfd8858962cc53ad77716433

See more details on using hashes here.

Supported by

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