Skip to main content

Snap pixels to a perfect grid - designed to fix messy pixel art generated by AI. Based on original work: https://github.com/Hugo-Dz/spritefusion-pixel-snapper/tree/main

Project description

Sprite Fusion Pixel Snapper - Python Binding

A Python binding for Pixel Snapper by Hugo Duprez. Snap pixels to a perfect grid - designed to fix messy and inconsistent pixel art generated by AI.

Example

Input Output
Input Output

Installation

pip install pixel-snapper

Or build from source with maturin:

pip install maturin
maturin develop --features python

Usage

Library

from pixel_snapper import PixelSnapperConfig, process_image, process_file_cli

# Process image bytes
config = PixelSnapperConfig(k_colors=16, pixel_size_override=8)
output_bytes = process_image(input_bytes, config)

# Process file directly
process_file_cli("input.png", "output.png", config)

CLI

pixel-snapper input.png output.png
pixel-snapper input.png output.png 16
pixel-snapper input.png output.png --pixel-size 8
pixel-snapper sprites/batch_inputs sprites/batch_outputs 16

Batch processing with progress

from pixel_snapper import PixelSnapperConfig, process_batch

def on_event(event):
    print(f"[{event['type']}] {event}")

config = PixelSnapperConfig(k_colors=16)
process_batch("input_dir", "output_dir", config, on_event)

Acknowledgments

This is a Python binding fork of spritefusion-pixel-snapper by Hugo Duprez. All credit for the original Rust implementation goes to the original authors.

License

MIT License - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pixel_snapper-0.1.0-cp313-cp313-win_amd64.whl (479.1 kB view details)

Uploaded CPython 3.13Windows x86-64

pixel_snapper-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl (676.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

pixel_snapper-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (590.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pixel_snapper-0.1.0-cp312-cp312-win_amd64.whl (479.1 kB view details)

Uploaded CPython 3.12Windows x86-64

pixel_snapper-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl (676.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

pixel_snapper-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (590.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pixel_snapper-0.1.0-cp311-cp311-win_amd64.whl (480.1 kB view details)

Uploaded CPython 3.11Windows x86-64

pixel_snapper-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl (676.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

pixel_snapper-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (590.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pixel_snapper-0.1.0-cp310-cp310-win_amd64.whl (479.9 kB view details)

Uploaded CPython 3.10Windows x86-64

pixel_snapper-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl (676.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

pixel_snapper-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (591.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pixel_snapper-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl (676.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

pixel_snapper-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (591.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pixel_snapper-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl (677.0 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.34+ x86-64

pixel_snapper-0.1.0-cp38-cp38-macosx_11_0_arm64.whl (591.8 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file pixel_snapper-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 aaba9235148cf464762502dc4e495cf8463dc4646f0838d0de08af43312c0c62
MD5 cb9f2d6410aa34ccf13a1bdb02365510
BLAKE2b-256 a3cdea207489e5a1194cab7c3d6475a66ece74b8b7c2282320a28ee7925fd90c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp313-cp313-win_amd64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 47f66bd4e71244f6833c72844875552e5ef56468203f09c84ce5ecd5a9abaf9b
MD5 b638e8992e1f677aafbe7634b9397c1d
BLAKE2b-256 ded100ebd6995f1d4225ba5ed33323f7b65aa0853dd3bde437decac2c7e66864

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 463c5941594dafca10483b1df83b38143e74ab050fe915c86ba17d0498fad351
MD5 d194e94df7b66f282783045aff136a55
BLAKE2b-256 c5c26810c548c847d2673d5733abd90e2b22ee29a58e6c79222078aa0497a6ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1b2362d78e6e58a33ab1bad33675ad386cdb087d4dbca1dccc9b7c1af15650b6
MD5 598452e7a5622e43023b9ac62c6a3276
BLAKE2b-256 3e7c362dba68741249b16808ca6e7c47fbeddbf110ac554211fd505c33950da7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp312-cp312-win_amd64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b7fe6c393f91a5281c073cd31f12a47cede654a4afa6b889ef3a52e3673319f7
MD5 e94c2c3819cf232f5f4adc2919bcb96d
BLAKE2b-256 7898e9669fe00ecaeeaa3dcaaeaa8e1393ee293ad5d77af1ef4306cb06bffc46

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f519afe6152b8a6023fa4a4f9ca7cc6c8a4e3110d44aa2d416e3d46d0aadff5b
MD5 947a27775df3435f7dd68bdc4f333b00
BLAKE2b-256 4d6127a1ff7a32edd3a9ca7cf032fa93a784a5975157f289456f793c95ce7613

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6d4cb516c2d874bb1a2767a24ab706fbb6e7937ff9b495cd701d29c98b7a30c1
MD5 4b30ac12082159068d1ca6e5ee5ce31e
BLAKE2b-256 6239b170c4aea6f37391ba0ce901b2486bcc26e6abb6b9e35772e18b837538cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp311-cp311-win_amd64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 910f99eee8036414d613e6cfb3a91606a41c933222fed4cf6ccdce46a954776b
MD5 ab16073a6fc11267b08d71a886c050ac
BLAKE2b-256 2830d6d0ebaf1edcb95d9c906fedd4ac7db7fe0ee48ae18c2590e88c03605e83

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c6c3e6c810199829622e39f4be0aa071bc66722f60a70fb54e4d6fdca507520f
MD5 507072bc3179d6b8fd06012ed723d848
BLAKE2b-256 f4aa11b743309796c85ce3821aea2038b9cb3e5cb01a51c5c3dabd4f23b27376

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0a59e486808745bca586cb662126d1d6492ccc474ab0e7914d23e0ad9b2e7bc0
MD5 d6c32cff1f3cd569d1920306ab99507e
BLAKE2b-256 a0825f4d1d982472073257b588b8a243a07038907a311f1119566deea7b4da91

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp310-cp310-win_amd64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 35d7088929dd2e06e1215cdf98baf8493d0e105a24b77612dbebf9fe45555ed8
MD5 0e5ea8de08b7cf1aa91ea94707d00e14
BLAKE2b-256 974eeb5a294158c801b659d1de6849e52b1d94ec1b878e5f13a2787f4dd27105

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 81386dc722925075d640495ca23ba557f82a4e9fa7631315b034cced93701df8
MD5 4bf8c487f2463f1890b68ee0741d410b
BLAKE2b-256 82de5bf965516f52aa7d8fe7f19de1d9be1462eaa85afb04de2c135c683465b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 07d4c751ef1c0c0ee0f32212b2e56b5408c6d998c8653c9a0a6ecd3e221c4d69
MD5 ead84897d055ec19cf6a74f362ad49e1
BLAKE2b-256 d0a39344132eb36d274c6d648771e1ef2987b7d80511c34dfc80fa5d5c8fb7c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c4dd6967b3f3d59061f947f14149320c034e78241f0605ae42db2aeb592bb7b
MD5 31bbf97771dc8c6ad838a050eac9846c
BLAKE2b-256 b909be73e3368fe48cae21cacbd72cc94bb44e752a0319d529a0da61ed7d0b6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2643c8f036ea000d14f7debf3db3adb985b413e55c61fbdbb392bb8cbe14aae1
MD5 4dbb929b7a8498ffef06fc30eda7cf79
BLAKE2b-256 7958085f20a6979a62f1edff00efd5e80590120ea40d5852bfc798421479abc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp38-cp38-manylinux_2_34_x86_64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pixel_snapper-0.1.0-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pixel_snapper-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a21382e39a5ec9e6e638b2a210f1767a6871c5852e5954cbe0682d9bc2f6f66b
MD5 de8f7ad94cb805a10f11e04e05b789ae
BLAKE2b-256 e0e650c194774a4a4b357857894aecdd510d8cfcea327bab2fbede814984f3f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pixel_snapper-0.1.0-cp38-cp38-macosx_11_0_arm64.whl:

Publisher: workflow.yml on NoRaincheck/pixel-snapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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