ASTC decoder for PIL
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
astc_codec-1.0.2.tar.gz
(86.3 kB
view details)
File details
Details for the file astc_codec-1.0.2.tar.gz
.
File metadata
- Download URL: astc_codec-1.0.2.tar.gz
- Upload date:
- Size: 86.3 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d7675639362b48179a5c9c56bdf7606957522fe8040c215ba72b66056170a13 |
|
MD5 | a3023d9ea2a444cac43a19f3f67151fa |
|
BLAKE2b-256 | bde44f37c1ff304b1e8d980613be0f57c347850f8b5d54edc49d8d3b18b6a581 |