PixelOE  by KohakuBlueleaf

Python library for detail-oriented pixel art generation from images

created 1 year ago
344 stars

Top 81.6% on sourcepulse

GitHubView on GitHub
Project Summary

PixelOE is a Python library for generating high-quality pixel art from standard images without AI or neural networks. It targets artists and developers seeking a detail-oriented, contrast-aware approach to pixelization, offering predictable results and preserving fine details through classical image processing techniques.

How It Works

PixelOE employs a two-stage process. First, "Contrast-Aware Outline Expansion" enhances key features by generating a weight map based on local contrast and brightness, then applying selective morphological operations (erosion/dilation) blended according to these weights. This preserves important edges before downscaling. Second, "Contrast-Based Downsampling" processes luminance and color channels separately. It uses a sliding window to select the most representative pixel within each patch based on value distribution, ensuring luminance details are maintained, while color channels are smoothed with a median filter.

Quick Start & Requirements

  • Install via pip: pip install pixeloe
  • ComfyUI integration: Clone repo into custom_nodes directory.
  • Python API: Supports legacy (NumPy/CV2) and fast PyTorch (GPU accelerated) implementations.
  • Requirements: Python, PyTorch (for GPU acceleration).
  • Demo: Gradio client available at ./client/demo-gr.py.
  • CLI: pixeloe.pixelize and pixeloe.outline commands.

Highlighted Details

  • Pure PyTorch implementation achieves >180 img/sec (bs1) on RTX4090.
  • Core logic is GPU-free and can run on CPU.
  • Offers multiple downscaling modes (center, contrast, k-centroid, bicubic, nearest).
  • Includes optional color palette optimization and color matching.

Maintenance & Community

  • Project maintained by KohakuBlueleaf.
  • Mentions Claude 3 opus and Gemini 2.0 Flash for code assistance.
  • Citation available in BibTeX format.

Licensing & Compatibility

  • License: MIT License.
  • Compatibility: Suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

The CLI is noted as using a legacy API and will be deprecated. While GPU-free operation is supported, the fastest performance is achieved with PyTorch and a GPU.

Health Check
Last commit

1 month ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
29 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.