Skip to main content

The hqx upscaling algorithm in Python

Project description

Code style: black Pylint License PyPi

hqx (high quality scale) is a family of pixel art scaling algorithms that work by detecting differences between pixels in the YUV colorspace.

hq2x scales an image by 2x, hq3x by 3x, and hq4x by 4x.

This is a Python port of hqx, unoptimized. It is not intended to be used for videos or scenarios where low latency is required. Right now, it only supports RGB, not RGBA (no transparency support).


Table of contents


📦 Installation

hqx is available on PyPi. It requires a Python version of at least 3.10.0. It depends on Pillow.

To install hqx with pip, run:

python -m pip install hqx

🛠 Usage

You can either use hqx.hqx_scale, hqx.hq2x, hqx.hq3x, or hqx.hq4x.

import hqx
import PIL.Image

image: PIL.Image.Image = PIL.Image.open(...)
x2:    PIL.Image.Image = hqx.hq2x(image)
x3:    PIL.Image.Image = hqx.hq3x(image)
x4:    PIL.Image.Image = hqx.hq4x(image)

# x2 == hqx.hqx_scale(image, 2))
# x3 == hqx.hqx_scale(image, 3))
# x4 == hqx.hqx_scale(image, 4))

📰 Changelog

The changelog is at CHANGELOG.md.


📜 License

hqx (python) is licensed under the Lesser GNU Public License v2.1 (LGPL-2.1).

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

hqx-1.0.tar.gz (24.5 kB view hashes)

Uploaded Source

Built Distribution

hqx-1.0-py3-none-any.whl (26.9 kB view hashes)

Uploaded Python 3

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