Giter VIP home page Giter VIP logo

xbrz.py's Introduction

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.

xbrz.py's People

Contributors

ioistired avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

karltdebiec

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.