ASTC_Codec
An ASTC decoder for PIL.
The decoder uses Google/astc-codec to decompress the data.
Installation
- Cython required
PIP
pip install astc_codec
Manual
python setup.py install
Usage
valid block_sizes
| block size | footprint | footprint id |
|---|---|---|
| (4, 4) | k4x4 | 0 |
| (5, 4) | k5x4 | 1 |
| (5, 5) | k5x5 | 2 |
| (6, 5) | k6x5 | 3 |
| (6, 6) | k6x6 | 4 |
| (8, 5) | k8x5 | 5 |
| (8, 6) | k8x6 | 6 |
| (10, 5) | k10x5 | 7 |
| (10, 6) | k10x6 | 8 |
| (8, 8) | k8x8 | 9 |
| (10, 8) | k10x8 | 10 |
| (10, 10) | k10x10 | 11 |
| (12, 10) | k12x10 | 12 |
| (12, 12) | k12x12 | 13 |
PIL.Image decoder
from PIL import Image
import astc_codec
#needs to be imported once in the active code, so that the codec can register itself
raw_astc_image_data : bytes
block_size = (int, int) # see valid block_sizes
img = Image.frombytes('RGBA', size, raw_astc_image_data, 'astc', block_size)
raw decoder
from astc_codec import decompress_astc, ASTCDecompressToRGBA
# ASTC to RGBA
rgba_data = decompress_astc(astc_data : bytes, block_size : (int, int), width : int, height : int)
# ASTC to RGBA, direct mapping to the C++ function
# footprint = footprint id from valid block_sizes
rgba_data = ASTCDecompressToRGBA(astc_data : bytes, astc_data_size : int,
width : int, height : int, footprint : int, out_buffer_size : int,
out_buffer_stride : int)
Metadata
Release files for astc-codec 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| astc_codec-1.0.2.tar.gz | 86.3 kB | Details |
Release files / astc_codec-1.0.2.tar.gz
| Download URL | astc_codec-1.0.2.tar.gz |
|---|---|
| Size | 86.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d7675639362b48179a5c9c56bdf7606957522fe8040c215ba72b66056170a13
|
|
BLAKE2b-256 checksum How to use checksums |
bde44f37c1ff304b1e8d980613be0f57c347850f8b5d54edc49d8d3b18b6a581
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|