Skip to main content

A lightweight Python wrapper around Microsoft's Texconv (DirectXTex)

Project description

Texconv-Py

A lightweight Python wrapper around Microsoft's Texconv (DirectXTex).

Features

  • Type hints for every setting and flag
  • Checks for conflicting options

Requirements

Installation

pip install texconv-py

Usage

Converting a DXT5 Normal Map

from pathlib import Path
from texconv import Texconv, FileOptions, ImageOptions, NormalMapOptions, FormatOptions, Format

TEXCONV = Path(r"path\to\Texconv.exe")

# Creating the Texconv instance
fix_nmap_dxt5 = Texconv(TEXCONV, 
        FileOptions(
            output=Path(r"path\to\output\folder"),
            overwrite=True),
        ImageOptions(swizzle="ga11"),
        NormalMapOptions(invert_y=True, reconstruct_z=True),
        FormatOptions(format=Format.DXGI_FORMAT_BC1_UNORM)
        )

# Using a list of Path (or strings)
nmaps = [
    Path(r"path\to\tex1_n.dds"),
    Path(r"path\to\tex42_n.dds"),
    Path(r"path\to\tex10_n.dds"),
    Path(r"path\to\test_n.dds")
]

# Running Texconv
fix_nmap_dxt5.run(nmaps)

Performing various changes to images using a text file for the paths

from pathlib import Path
from texconv import Texconv, FileOptions, ImageOptions, FileType, FormatOptions

TEXCONV = Path(r"path\to\Texconv.exe")

Texconv(TEXCONV, 
    FileOptions(
        output=Path(r"path\to\output\folder"),
        overwrite=True,
        to_lowercase=True,
        prefix='pre_'),
    ImageOptions(horizontal_flip=True),
    FormatOptions(file_type=FileType.PNG)
).run(r"path\to\textures.txt", file_list=True)

License

MIT License — see LICENSE for details.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

texconv_py-1.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

texconv_py-1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file texconv_py-1.0.tar.gz.

File metadata

  • Download URL: texconv_py-1.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for texconv_py-1.0.tar.gz
Algorithm Hash digest
SHA256 afb7e7b6b2453d1b9272e73aec8e7da4713f2738a59b06e750888608daa5e998
MD5 3f79cd17f25a30e1b0c0a6fec4b5916c
BLAKE2b-256 e1be8b13b4d2c18df7516bbfe6fcfa91b67280bcdf2c478a7e90cf801c227329

See more details on using hashes here.

File details

Details for the file texconv_py-1.0-py3-none-any.whl.

File metadata

  • Download URL: texconv_py-1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for texconv_py-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 369b20f9e468ccb06f28b29b1705264c5881a12fed20781e9ecdefdfdb5b524a
MD5 04ddf9b1842a0b08aa1aa187be683326
BLAKE2b-256 e93a993feeecd2053faba605f25d0def937bf1606ac6d742618d8a68c5168a40

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