Skip to content

[Feature] Super Pixel Sorting - #35

Open
wmccall wants to merge 28 commits into
satyarth:masterfrom
wmccall:master
Open

wmccall wants to merge 28 commits into
satyarth:masterfrom
wmccall:master

Conversation

@wmccall

@wmccall wmccall commented Jul 4, 2026

Copy link
Copy Markdown

Why add this feature?

There are some difficulties in pixel sorting large images:

  • They have a LOT of data to process. This can be a terribly slow effort iterating over tens of millions of pixels.
  • Given that a pixel is a discrete, fixed size, its individual impact on an image diminishes as image size increases. In other words, sorting pixels at the individual pixel level can make the image look smudgy, rather than capture that crisp pixel sort we love.

To combat both of these issues, Super Pixels were the way forward. Super Pixels are quite simple, really: a NxN chunk of pixels. The algorithm will use the average color information of the Super Pixel to sort chunks of the image. Breaking the image down like this allows us to reduce the sorting iterations, and gives the final product a more digital and crisp style, all the while retaining the image's original scale and detail.

Changes:

  • Add ability to specify a "super pixel size" to split the image into chunks which get treated as the units which get sorted (based on averages of the collection of pixels)
    • This helps with speed of sorting + adds a new style
  • Defaults super pixel size to 1, so if omitted, doesn't impact pixel sorting operations before this PR
  • Add two new dependencies:
    • black for formatting
    • numpy for improved sorting times
  • Update documentation, does not support python 2 with these changes

Reference Images:

Original Input

large_image_small

Sorted Image w/ super pixel size 20

super_pixels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant