Skip to main content

ctypes-based binding library for the xBRZ pixel-art image scaling algorithm

Project description

xbrz.py

Build Status

xbrz.py is a simple ctypes-based binding library for xBRZ, a high-quality pixel-art image scaling algorithm.

Installation

Wheels are available for many platforms. If there isn't one for your platform, make sure you have a C++ compiler handy.

pip install xbrz.py

Usage

import xbrz

# pixels is a list of 32 bit ints representing RGBA colors.
# It is 32 * 24 long.
pixels = ...
scaled_pixels = xbrz.scale(pixels, 6, 32, 24, xbrz.ColorFormat.RGBA)

# scaled_pixels is a 32 * 24 * 6 ** 2 long list of 32 bit ints representing the scaled image.

Wand / Pillow support

You can pass a Wand image to xbrz.scale_wand(img, factor) or a Pillow image to xbrz.scale_pillow(img, factor). Neither libraries are required to use xbrz.py, however they can be installed via:

pip install xbrz.py[wand]
# or
pip install xbrz.py[pillow]

xbrz.py as an executable module

Passing raw RGBA pixels to python3 -m xbrz <factor> <width> <height> via stdin will output scaled raw RGBA pixels to stdout.

License

AGPLv3, see LICENSE.md. The original xBRZ code is GPLv3 licensed.

  • lib/ is based on code provided by Zenju under the GPLv3 license. See lib/License.txt for details. Some changes were made:
    • Added some extern "C" declarations to the functions I intended to call from python.
    • Removed some namespace use to avoid being mangled.
    • Replaced a C++ template with a simple function that takes two arguments.
    • Converted the library to use RGBA instead of ARGB.
  • xbrz.py is based on lib/ and is released under the AGPLv3 license, see LICENSE.md for details.

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

xbrz.py-1.0.2.tar.gz (27.1 kB view hashes)

Uploaded Source

Built Distributions

xbrz.py-1.0.2-pp37-pypy37_pp73-win32.whl (61.5 kB view hashes)

Uploaded PyPy Windows x86

xbrz.py-1.0.2-pp37-pypy37_pp73-manylinux2010_x86_64.whl (85.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

xbrz.py-1.0.2-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (106.5 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

xbrz.py-1.0.2-pp36-pypy36_pp73-manylinux2010_x86_64.whl (85.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

xbrz.py-1.0.2-pp36-pypy36_pp73-macosx_10_9_x86_64.whl (106.5 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

xbrz.py-1.0.2-cp39-cp39-win_amd64.whl (60.4 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

xbrz.py-1.0.2-cp39-cp39-win32.whl (61.5 kB view hashes)

Uploaded CPython 3.9 Windows x86

xbrz.py-1.0.2-cp39-cp39-manylinux2014_aarch64.whl (87.5 kB view hashes)

Uploaded CPython 3.9

xbrz.py-1.0.2-cp39-cp39-manylinux2010_x86_64.whl (85.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

xbrz.py-1.0.2-cp39-cp39-manylinux2010_i686.whl (81.2 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

xbrz.py-1.0.2-cp39-cp39-manylinux1_x86_64.whl (85.3 kB view hashes)

Uploaded CPython 3.9

xbrz.py-1.0.2-cp39-cp39-manylinux1_i686.whl (81.2 kB view hashes)

Uploaded CPython 3.9

xbrz.py-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl (105.6 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

xbrz.py-1.0.2-cp38-cp38-win_amd64.whl (60.4 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

xbrz.py-1.0.2-cp38-cp38-win32.whl (61.5 kB view hashes)

Uploaded CPython 3.8 Windows x86

xbrz.py-1.0.2-cp38-cp38-manylinux2014_aarch64.whl (87.5 kB view hashes)

Uploaded CPython 3.8

xbrz.py-1.0.2-cp38-cp38-manylinux2010_x86_64.whl (85.3 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

xbrz.py-1.0.2-cp38-cp38-manylinux2010_i686.whl (81.2 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

xbrz.py-1.0.2-cp38-cp38-manylinux1_x86_64.whl (85.3 kB view hashes)

Uploaded CPython 3.8

xbrz.py-1.0.2-cp38-cp38-manylinux1_i686.whl (81.2 kB view hashes)

Uploaded CPython 3.8

xbrz.py-1.0.2-cp38-cp38-macosx_10_9_x86_64.whl (105.6 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

xbrz.py-1.0.2-cp37-cp37m-win_amd64.whl (60.4 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

xbrz.py-1.0.2-cp37-cp37m-win32.whl (61.5 kB view hashes)

Uploaded CPython 3.7m Windows x86

xbrz.py-1.0.2-cp37-cp37m-manylinux2014_aarch64.whl (87.5 kB view hashes)

Uploaded CPython 3.7m

xbrz.py-1.0.2-cp37-cp37m-manylinux2010_x86_64.whl (85.3 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

xbrz.py-1.0.2-cp37-cp37m-manylinux2010_i686.whl (81.2 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

xbrz.py-1.0.2-cp37-cp37m-manylinux1_x86_64.whl (85.3 kB view hashes)

Uploaded CPython 3.7m

xbrz.py-1.0.2-cp37-cp37m-manylinux1_i686.whl (81.2 kB view hashes)

Uploaded CPython 3.7m

xbrz.py-1.0.2-cp37-cp37m-macosx_10_9_x86_64.whl (105.6 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

xbrz.py-1.0.2-cp36-cp36m-win_amd64.whl (60.4 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

xbrz.py-1.0.2-cp36-cp36m-win32.whl (61.5 kB view hashes)

Uploaded CPython 3.6m Windows x86

xbrz.py-1.0.2-cp36-cp36m-manylinux2014_aarch64.whl (87.5 kB view hashes)

Uploaded CPython 3.6m

xbrz.py-1.0.2-cp36-cp36m-manylinux2010_x86_64.whl (85.3 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

xbrz.py-1.0.2-cp36-cp36m-manylinux2010_i686.whl (81.2 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

xbrz.py-1.0.2-cp36-cp36m-manylinux1_x86_64.whl (85.3 kB view hashes)

Uploaded CPython 3.6m

xbrz.py-1.0.2-cp36-cp36m-manylinux1_i686.whl (81.2 kB view hashes)

Uploaded CPython 3.6m

xbrz.py-1.0.2-cp36-cp36m-macosx_10_9_x86_64.whl (105.6 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ 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