Python wrapper around Crunch DXTc decompressor
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
crunch Fix OSX build Apr 1, 2017
tests Add tests and test resources for dxt1 and dxt5 Mar 7, 2017
.gitignore Initial commit of decrunch library Mar 5, 2017
.travis.yml Run tests on Travis Mar 7, 2017
LICENSE Clarify license Oct 1, 2018
MANIFEST.in Add setup metadata Mar 7, 2017
README.md Clarify license Oct 1, 2018
crn_decomp.cpp Fix build on FreeBSD Oct 1, 2018
crunch.h Initial commit of decrunch library Mar 5, 2017
decrunch.pyx Add setup metadata Mar 7, 2017
setup.cfg Release 0.3.1 Oct 1, 2018
setup.py Add setup metadata Mar 7, 2017

README.md

decrunch

Build Status

decrunch is a Python wrapper around crunch's decompressor.

Setup

  • To install directly from PyPI: pip install decrunch
  • To install from source: pip install Cython, then ./setup.py install

Usage

import decrunch

with open("example.crn", "rb") as f:
	buf = f.read()

fi = decrunch.File(buf)
tex_info = fi.info()

for level in range(tex_info["levels"]):
	print("Level info %i: %r" % (level, fi.info(level)))

with open("out.bc1", "wb") as f:
	f.write(fi.decode_level(0))

Further image decoding requires a DXTn decompressor, such as the one that can be found in Pillow as bcn.

License

The full license text is available in the LICENSE file. See crunch/license.txt for the license of files in the crunch/ subdirectory.

The files in crunch/ are an unaltered subset of the original code; the entirety of crunch may be obtained at https://github.com/BinomialLLC/crunch.