Metadata-Version: 2.4
Name: fusebead
Version: 0.1.0
Summary: Turn a photo into a fuse-bead pattern, with palette matching, bead counts, and a printable PNG.
Author-email: ROCKIMG <admin@rockimg.com>
License-Expression: MIT
Project-URL: Homepage, https://www.rockimg.com/perler-bead-pattern-maker.html
Project-URL: Documentation, https://www.rockimg.com/perler-bead-pattern-maker.html
Keywords: fuse-bead,bead-pattern,pixel-art,image
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pillow>=10
Dynamic: license-file

# fusebead

Turn a photo into a fuse-bead pattern: a pegboard grid, the nearest bead color, a printable PNG, and a color-count chart.

Color matching follows the [ROCKIMG fuse-bead pattern maker](https://www.rockimg.com/perler-bead-pattern-maker.html): sRGB to CIE Lab, CIE76 distance, the same brightness and contrast sliders, and the same three palettes.

Perler, Hama, and Artkal are trademarks of their owners. This package is not affiliated with those brands. Palette RGB values are the approximations used by the website, not official manufacturer color cards.

## Install

```bash
pip install fusebead
```

From a checkout of this repository:

```bash
pip install -e packages/fusebead
```

Requires Python 3.9+ and Pillow.

## Library

```python
from fusebead import Pattern

pattern = Pattern.from_image(
    "cat.png",
    palette="perler",      # perler, hama, or artkal
    grid_width=50,         # max pegs on the long side; aspect ratio is kept
    grid_height=50,
    brightness=0,          # website slider range is -80..80
    contrast=0,
    remove_background=True,
)
pattern.save_png("pattern.png")
pattern.save_csv("beads.csv")

pattern.width, pattern.height
pattern.total
pattern.cell(0, 0)          # BeadColor or None when the background was removed
pattern.entries[0].color.code
pattern.entries[0].count
```

Phone photos are rotated with EXIF orientation before sampling. The website canvas does not do that step.

## Command line

```bash
fusebead cat.png -o pattern.png --csv beads.csv --palette hama --width 40 --height 40 --remove-bg
```

`--no-grid` draws beads flush. `--bead-size` sets the peg diameter in pixels. By default the PNG width follows the source image, capped at 1000 pixels, and each peg is at least 4 pixels.
