Convert images to Excel spreadsheets where each cell is a colored pixel
Project description
image2excel
Convert any image into an Excel spreadsheet where each cell is a pixel, colored to recreate the original image.
Installation
pip install image2excel
Or with uv:
uv add image2excel
Quick Start
Python API
from image2excel import im2xlsx
# Basic usage - creates photo.xlsx alongside the source image
im2xlsx("photo.png")
# Keep original size (no resizing)
im2xlsx("photo.png", resize=False)
# Resize while preserving aspect ratio
im2xlsx("photo.png", keep_aspect=True)
Command Line
# Convert an image
image2excel photo.png
# Skip resizing
image2excel photo.png --no-resize
# Preserve aspect ratio
image2excel photo.png --keep-aspect
How It Works
- Opens the image and converts it to RGB
- Optionally resizes to fit within 260x300 pixels (configurable)
- Maps each pixel to an Excel cell with a matching background color
- Sets the zoom to 10% so you can see the full picture
The output .xlsx file is saved next to the source image.
API Reference
im2xlsx(file, *, resize=True, keep_aspect=False) -> Path
| Parameter | Type | Default | Description |
|---|---|---|---|
file |
str | Path |
- | Path to the source image |
resize |
bool |
True |
Shrink images larger than 260x300 |
keep_aspect |
bool |
False |
Preserve aspect ratio when resizing |
Returns: Path to the generated .xlsx file.
Development
# Clone and install with dev dependencies
git clone https://github.com/michelkluger/excel2image.git
cd excel2image
uv sync --dev
# Run tests
uv run pytest
# Lint and format
uv run ruff check .
uv run ruff format .
# Type check
uv run ty check src/
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
image2excel-1.0.0.tar.gz
(6.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file image2excel-1.0.0.tar.gz.
File metadata
- Download URL: image2excel-1.0.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4df69e870ffda99c269c7f899f83d4387e2aaf4c358a2aae8d057c7a246153a6
|
|
| MD5 |
059ac554e70a771222e58a3e3a03f7c1
|
|
| BLAKE2b-256 |
bad3964a70e30b3cd4724c0df04b8f6d39ce93003fd8c6e9ab27cabd63107f4e
|
File details
Details for the file image2excel-1.0.0-py3-none-any.whl.
File metadata
- Download URL: image2excel-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d954b2833e0f76d201973f944be43a5cab733c4e70fe2728024ced24e1fed8e5
|
|
| MD5 |
9df721547d28e2b8a50c7ad29726d5b8
|
|
| BLAKE2b-256 |
eb764d9384ab4dc700909584847abef2cd4e3b3de5396e4c46489f6d7f6b426c
|