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.
Metadata
Release files for vtf2img 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vtf2img-0.1.0.tar.gz | 7.2 kB | Without provenance | Details for vtf2img-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vtf2img-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for vtf2img-0.1.0-py3-none-any.whl |
Total release size: 18.5 kB
Release files / vtf2img-0.1.0.tar.gz
| Download URL | vtf2img-0.1.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6265acf3aef777bdb01f89d33973f80051acda0ac8113967e2cd4c0f93df1340
|
|
BLAKE2b-256 checksum How to use checksums |
b03b848fe1785a358c7e9605e4d11043f9261411a876754705308f835557f75c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / vtf2img-0.1.0-py3-none-any.whl
| Download URL | vtf2img-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
422d5888cf434e30179f0a2068423f1456b4dff2d78a96163afaf2b25195e492
|
|
BLAKE2b-256 checksum How to use checksums |
78048248534c3b357e0aaceae5b7728ff49e2244bfd8858962cc53ad77716433
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for vtf2img 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.