
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
pixeloe
Advanced tools
Create stunning pixel art from high-resolution images without AI or complex networks.
![]()
PixelOE is a Python library that generates high-quality pixel art from standard images using a novel, contrast-aware approach. This method focuses on preserving crucial visual details by first expanding outlines of key features, then applying an intelligent downscaling to the target resolution.
Key Features:

We provide ComfyUI Custom Node implementation in this repository directly, you just need to clone this repo into the custom_node directory and it will work!
cd custom_nodes
git clone https://github.com/KohakuBlueleaf/PixelOE
There are 3 nodes are provided in this extensions:
To utilize this package in your code or utilize its CLI implementation, you need to install it with pip first:
pip install pixeloe
Note: CLI in PixelOE is currently using legacy API which will be deprecated in near future.
The pixeloe package provides two primary commands:
pixeloe.pixelize: Full pixelization processpixeloe.outline: Outline expansionTo view command usage, use the --help flag:
pixeloe.pixelize --help
usage: pixeloe.pixelize [-h] [--output_img OUTPUT_IMG] [--mode {center,contrast,k-centroid,bicubic,nearest}] [--target_size TARGET_SIZE]
[--patch_size PATCH_SIZE] [--thickness THICKNESS] [--no_color_matching] [--contrast CONTRAST]
[--saturation SATURATION] [--colors COLORS] [--no_upscale] [--no_downscale]
input_img
positional arguments:
input_img
options:
-h, --help show this help message and exit
--output_img OUTPUT_IMG, -O OUTPUT_IMG
--mode {center,contrast,k-centroid,bicubic,nearest}, -M {center,contrast,k-centroid,bicubic,nearest}
--target_size TARGET_SIZE, -S TARGET_SIZE
--patch_size PATCH_SIZE, -P PATCH_SIZE
--thickness THICKNESS, -T THICKNESS
--no_color_matching
--contrast CONTRAST
--saturation SATURATION
--colors COLORS
--no_upscale
--no_downscale
Example:
pixeloe.pixelize img/test.webp --output_img img/test2.webp --target_size 256 --patch_size 8
install gradio first:
pip install gradio
Than run the gradio client server:
python ./client/demo-gr.py
You can integrate PixelOE directly into your Python/Pytorch projects:
legacy API (numpy/cv2 based, slow)
import cv2
from pixeloe.pixelize import pixelize
img = cv2.imread("img/test.webp")
img = pixelize(img, target_size=256, patch_size=8)
cv2.imwrite("img/test2.webp", img)
torch API (Fast, GPU supported)
import torch
from PIL import Image
from pixeloe.torch.pixelize import pixelize
from pixeloe.torch.utils import to_numpy, pre_resize
img = Image.open("img/snow-leopard.webp")
img = pre_resize(img, target_size=256, patch_size=4).cuda().half()
result = pixelize(img, pixel_size=4, thickness=3)
result_img = Image.fromarray(to_numpy(result)[0])
result_img.save("img/snow-leopard-pixel.webp")
| Original | Expanded |
|---|---|
![]() | ![]() |
With this outline expansion method, you can obtain descent pixelization through some naive downsampling method:
| Expanded | Dowsampled |
|---|---|
![]() |



Use the outline expansion method can improve lot of existing pixelization method. Even the Neural Network based method can also be improved:
Here is the example of using outline expansion to improve "Make Your Own Sprites: Aliasing-Aware and Cell-Controllable Pixelization"(SIGGRAPH Asia 2022)
![]()
The PixelOE algorithm has two key stages:
This step is designed to make sure that fine details and high-contrast edges will survive after the downscaling step. Here is the process:
Weight Map Generation:
Selective Morphological Operations:
| Dilation | Erosion |
|---|---|
![]() | ![]() |
| Blended | Weight |
|---|---|
![]() | ![]() |
This method reduces the image resolution while maintaining important luminance details.
find_pixel function is used, and each patch is processed independently.By adaptively selecting the most representative pixel for each local area, the downscaling method preserves important luminance details and edges to maintain the artistic style in pixel art.
@misc{PixelOE,
title={Detail-Oriented Pixelization based on Contrast-Aware Outline Expansion.},
author={Shin-Ying Yeh},
year={2024},
month={March},
howpublished=\url{https://github.com/KohakuBlueleaf/PixelOE},
}
FAQs
Detail-Oriented Pixelization based on Contrast-Aware Outline Expansion.
We found that pixeloe demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.