Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A PVRTC decoder for PIL

Project description

PVRTC Decoder

A PVRTC decoder for PIL.

The decoder uses PVRTDecompress from PVRCore to decompress the data.

Installation

  • Cython required

PIP

pip install pvrtc_decoder

Manual

python setup.py install

Usage

do2bit_mode:

  • 0 - PVRTC2 (8 bit)
  • 1 - PVRTC4 (16 bit)

PIL.Image decoder

from PIL import Image
import pvrtc_decoder 
#needs to be imported once in the active code, so that the codec can register itself

raw_pvrtc_image_data : bytes
do2bit_mode = 0 # see above
img = Image.frombytes('RGBA', size, raw_pvrtc_image_data, 'pvrtc', (do2bit_mode))

raw decoder

from pvrtc_decoder import decompress_pvrtc, decompress_etc

# compressed PVRTC image bytes to RGBA bytes
rgba_data = decompress_pvrtc(compressed_data : bytes, do2bit_mode : int, width : int, height : int)

# compressed ETC image bytes to RGBA bytes
# mode seems to be unused, so use any value you want
rgba_data = decompress_etc(src_data : bytes, width : int, height : int, mode : int)

Project details


Download files

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

Files for pvrtc-decoder, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size pvrtc_decoder-1.0.2-cp37-cp37m-win32.whl (32.8 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size pvrtc_decoder-1.0.2.tar.gz (46.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page