semvec/pypi-packages huggingface dataset:
excel-pixel-art 1.0.0
Convert images to Excel pixel art and back
Requires Python: >=3.9
Keywords: excel, image-conversion, openpyxl, pixel-art

# Excel Pixel Art

Convert images to Excel pixel art and back. Each cell becomes a pixel with its background colour matching the original image.

## Installation

```bash
pip install excel-pixel-art
```

Or install from source:

```bash
git clone https://github.com/luigipascal/excelart.git
cd excelart
pip install -e .
```

## Usage

### Convert Image to Excel

```bash
image2xlsx photo.png
image2xlsx photo.png -o output.xlsx
image2xlsx photo.png --max-size 150
```

Options:
- `-o, --output`: Output Excel file path (default: `<input>_excel.xlsx`)
- `--max-size`: Maximum dimension in cells (default: 100)

### Convert Excel Back to Image

```bash
xlsx2image output.xlsx
xlsx2image output.xlsx -o recovered.png
xlsx2image output.xlsx --sheet Sheet1
```

Options:
- `-o, --output`: Output image path (default: `<input>_reconstructed.png`)
- `--sheet`: Worksheet name to use (default: 'Image' if present, else active)
- `--background R,G,B`: Background colour for missing cells (default: 0,0,0)
- `--no-autocrop`: Disable auto-crop to solid-fill bounds

### QA & Verification

```bash
# Compare with original for fidelity check
xlsx2image output.xlsx --compare original.png

# Generate visual diff heatmap
xlsx2image output.xlsx --compare original.png --diff-image diff.png

# CI pass/fail with threshold
xlsx2image output.xlsx --compare original.png --diff-threshold 5
```

## Python API

```python
from excel_pixel_art import image_to_excel, excel_to_image, compare_images

# Convert image to Excel
image_to_excel("photo.png", "output.xlsx", max_size=100)

# Convert back
excel_to_image("output.xlsx", "recovered.png")

# Compare for QA
compare_images("photo.png", "recovered.png", diff_output="diff.png", diff_threshold=5)
```

## How It Works

1. **Image → Excel**: The image is resized to fit within `max_size` cells, maintaining aspect ratio. Each pixel becomes a cell with a solid fill colour matching the RGB value.

2. **Excel → Image**: Cells with solid fills are read back, extracting their ARGB colour values. Auto-crop detects the actual pixel bounds, ignoring stray formatting.

3. **QA Tools**: The fidelity report compares reconstructed images against originals, with optional diff heatmaps and threshold-based pass/fail for CI integration.

## Features

- **ARGB colour handling** - Proper Excel colour format (no transparency bugs)
- **Fill caching** - Fast generation even for images with thousands of unique colours
- **Auto-crop** - Ignores stray formatting outside the pixel grid
- **Robust extraction** - Handles both `fgColor` and `start_color` patterns
- **CI-friendly** - Threshold-based pass/fail for automated testing

## License

MIT
python-pytun 2.4.1
Linux TUN/TAP wrapper for Python

Linux TUN/TAP wrapper for Python
================================

``pytun`` is a Python module which let you create TUN/TAP device very easily.

License: MIT (see LICENSE)

Installation and Dependencies
-----------------------------

Install ``pytun`` with ``pip install python-pytun`` or `download this archive
<https://github.com/montag451/pytun/zipball/v2.3.0>`_, decompress it and
execute ``python setup.py install``. As ``pytun`` is a C module you will need a
compiler (e.g GCC) and the Python development headers installed on your
system (e.g on Debian-like distribution check that ``build-essential`` and
``python-dev`` are present). There are no dependencies other than the Python
Standard Library.

Documentation
-------------

NOTE: On most distributions you will need to be root to create TUN/TAP devices.

To create a TUN device::

    from pytun import TunTapDevice

    tun = TunTapDevice()

To create a TAP device::

    from pytun import TunTapDevice, IFF_TAP

    tap = TunTapDevice(flags=IFF_TAP)

To create a TUN/TAP device with a custom name use the ``name`` keyword::

    tun = TunTapDevice(name='mytun')

You can get/set some parameters of the device directly::

    print tun.name
    tun.addr = '10.8.0.1'
    tun.dstaddr = '10.8.0.2'
    tun.netmask = '255.255.255.0'
    tun.mtu = 1500

If the device is a TAP you can also get/set its MAC address::

    tap.hwaddr = '\x00\x11\x22\x33\x44\x55'
    print tap.hwaddr

To make the device persistent::

    tun.persist(True)

To bring up the device::

    tun.up()

To bring down the device::

    tun.down()

To enable/disable the queue associated with the device (works only if
it has been created with IFF_MULTI_QUEUE)::

    tun.mq_attach() # enable the queue
    tun.mq_attach(False) # disable the queue

To read/write to the device, use the methods ``read(size)`` and
``write(buf)``::

    buf = tun.read(tun.mtu)
    tun.write(buf)

To close the device::

    tun.close()

You can also use ``TunTapDevice`` objects with all functions that expect a
``fileno()`` method (e.g ``select()``)