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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file hqx-1.0.tar.gz.

File metadata

  • Download URL: hqx-1.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for hqx-1.0.tar.gz
Algorithm Hash digest
SHA256 6d680a53d2d3e279645581c1b4f45d4541c14a7a9082f79b976ae3c199d3cb08
MD5 31ab2d02606adef39993501ece1921d6
BLAKE2b-256 ee126e9bcd03c563c8feee5a75ca7da7008f6c6383385c84c03e8176df72bb69

See more details on using hashes here.

File details

Details for the file hqx-1.0-py3-none-any.whl.

File metadata

  • Download URL: hqx-1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for hqx-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0d84f405f6160cb844edaebabc23a9cea95970450a1686c26c75586c111631b
MD5 ac5c59c3dda781e993779aa8455a286e
BLAKE2b-256 5a746f3c29e4c7a9e40af96b9b0cb82dfafadb5b14ddca0e47b15269c8d9f1e4

See more details on using hashes here.

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