Skip to main content

python wrapper for etcpak

Project description

etcpak

PyPI supported Python versions Win/Mac/Linux MIT Build Status

A python wrapper for etcpak

Some changes were made to the original code to make it cross-platform compatible.

  1. Installation
  2. Example
  3. Functions

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


Download files

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

Source Distribution

etcpak-0.9.0.tar.gz (38.5 kB view hashes)

Uploaded Source

Built Distribution

etcpak-0.9.0-cp38-cp38-win_amd64.whl (33.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page