Skip to main content

Converts resized pixel arts to their original resolution

Project description

RePixelator 1.0.1

Converts resized pixel arts to their original resolution using FFT analysis.

demo image

(image from https://coub.com/view/4jwv7)

The program finds the most dominant frequency in the X and Y direction, which is the original pixel resolution of the image.
Edge pixel offset is corrected using phase data of FFT output.

Works best with landscape images.
Up to x50 zoomed image, down to 4x4 converted image size is supported.

Install

Python >= 3.5 is required.

pip install repixelator
pip install wxpython>=4.0.0 (for GUI, optional. Read GUI section for details)

CLI

repixelator in_file out_file [mul [nr_sigma [edge_thr]]]

The arguments are purely positional.

GUI

GUI requires wxpython phoenix(>=4.0.0).
Type repixelator-gui in the command line to launch the GUI.

GUI image

On Linux it's best to find pre-built wheel for wxpython.
The wheel build takes about 1-2 hours and it also might fail in the process if you're unlucky.
This is actually the primary reason why I made wxpython dependency to optional, I didn't want to give headache to someone.

For building wxpython wheel on Linux, you might have to install these packages first. (Tested with Linux Mint 20) sudo apt install make gcc libgtk-3-dev libgstreamer-gl1.0-0 freeglut3 freeglut3-dev python3-gst-1.0 libglib2.0-dev ubuntu-restricted-extras libgstreamer-plugins-base1.0-dev

Python API

  • OpenCV BGR image -> OpenCV BGR image
    rePixelate(img: np.ndarray, mul=4, nr_sigma=0.0, edge_threshold=1.0) -> (bool, np.ndarray)

  • File -> File
    rePixelateFile(in_file: str, out_file: str, mul='4', nr_sigma='0.0', edge_threshold='1.0') -> bool

bool tells if the conversion was successful or not.

Parameters

  • mul (int)
    Image pre zoom multiplier, used to spread out generated derivative edges.
    If you clearly see the pixels are huge enough (>5px), you can decrease this value to save resources.

  • nr_sigma (float)
    Noise reduction (Gaussian blur) sigma value.
    This option is not suitable for most images, only use with problematic noisy images.
    On GUI, the slider value is halved for convenience.

  • edge_threshold (float)
    If the image has cropped pixels on the edge, the program will offset the whole image to remove the more thin side.
    If the offset value is greater than this value, the edge will be included by expanding the edge with the image.
    Too small edge threshold will create "dirty edges", because there is not enough information to recreate the edge.
    Note that the offset value is not very stable, so setting low value is not good in general.

Dependencies

opencv-python
numpy
wxpython>=4.0.0 (optional)

Changelog

1.0.1

  • "Current directory" option now saves to the path where the command was typed.

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

repixelator-1.0.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repixelator-1.0.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file repixelator-1.0.1.tar.gz.

File metadata

  • Download URL: repixelator-1.0.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for repixelator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a0d76e9849662ae276a201aed1d52886f014fa1df84aa0871a4b6d76d5caf782
MD5 3121ece08642ba1a8406b6c0880ed9b8
BLAKE2b-256 640c04151b83b0790cc09120a1280904074f51556b75cbd32dc9449a5ec4ca8c

See more details on using hashes here.

File details

Details for the file repixelator-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: repixelator-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for repixelator-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b2147d606d107a19906cd69d5ab281ac595cebb3914ba6ab359bf670f76fb53
MD5 2501121a02fcd9a28b46cfe0ce74b31d
BLAKE2b-256 45297625e79097ea1c4e368d38e51c5071107d9f6a8dce88204b1caa057c5bd6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page