python wrapper for etcpak
Project description
etcpak
A python wrapper for etcpak
Some changes were made to the original code to make it cross-platform compatible.
Installation
pip install etcpak
or download/clone the git and use
python setup.py install
Example
from PIL import Image
import etcpak
# load image
img = Image.open(file_path)
# get image data
img_data = img.convert("RGBA").tobytes()
# compress data
compressed = etcpak.compress_to_dxt5(img_data, img.width, img.height)
Functions
- all functions accept only arguments, no keywords
- the given data has to be RGBA for the RGB function as well
compress_to_dxt1
Compresses RGBA to DXT1
:param data: RGBA data of the image :type data: bytes :param width: width of the image :type width: int :param height: height of the image :type height: int :returns: compressed data :rtype: bytes"
compress_to_dxt1_dither
Compresses RGBA to DXT1 Dither
:param data: RGBA data of the image :type data: bytes :param width: width of the image :type width: int :param height: height of the image :type height: int :returns: compressed data :rtype: bytes"
compress_to_dxt5
Compresses RGBA to DXT5
:param data: RGBA data of the image :type data: bytes :param width: width of the image :type width: int :param height: height of the image :type height: int :returns: compressed data :rtype: bytes"
compress_to_etc1
Compresses RGBA to ETC1 RGB
:param data: RGBA data of the image :type data: bytes :param width: width of the image :type width: int :param height: height of the image :type height: int :returns: compressed data :rtype: bytes"
compress_to_etc1_dither
Compresses RGBA to ETC1 Dither
:param data: RGBA data of the image :type data: bytes :param width: width of the image :type width: int :param height: height of the image :type height: int :returns: compressed data :rtype: bytes"
compress_to_etc1_alpha
Compresses A to ETC1 Alpha
:param data: RGBA data of the image :type data: bytes :param width: width of the image :type width: int :param height: height of the image :type height: int :returns: compressed data :rtype: bytes"
compress_to_etc2_rgb
Compresses RGBA to ETC2 RGB
:param data: RGBA data of the image :type data: bytes :param width: width of the image :type width: int :param height: height of the image :type height: int :returns: compressed data :rtype: bytes"
compress_to_etc2_rgba
Compresses RGBA to ETC2 RGBA
:param data: RGBA data of the image :type data: bytes :param width: width of the image :type width: int :param height: height of the image :type height: int :returns: compressed data :rtype: bytes"
compress_to_etc2_alpha
Compresses RGBA to ETC2 Alpha
:param data: RGBA data of the image :type data: bytes :param width: width of the image :type width: int :param height: height of the image :type height: int :returns: compressed data :rtype: bytes"
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
Built Distribution
Hashes for etcpak-0.9.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f390735bb870ad269b5b026b42f4c09f677c1ab8f19dbe1ab21ca5fcf6b99f35 |
|
MD5 | 5851eaea31584485cfedb6bd41dcef79 |
|
BLAKE2b-256 | 65ce875d2539914bedecad7a52bdbcac3be38a81c523b3462098148401638bbf |