Skip to main content

image2excel

CI Python 3.12+ License: MIT Ruff Typed

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

  1. Opens the image and converts it to RGB
  2. Optionally resizes to fit within 260x300 pixels (configurable)
  3. Maps each pixel to an Excel cell with a matching background color
  4. 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

MIT

Metadata

Release files for image2excel 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for image2excel 1.0.0
File Size Uploaded
image2excel-1.0.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for image2excel 1.0.0
File Interpreter ABI Platform
image2excel-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / image2excel-1.0.0.tar.gz

Download URL image2excel-1.0.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4df69e870ffda99c269c7f899f83d4387e2aaf4c358a2aae8d057c7a246153a6
BLAKE2b-256 checksum
How to use checksums
bad3964a70e30b3cd4724c0df04b8f6d39ce93003fd8c6e9ab27cabd63107f4e
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / image2excel-1.0.0-py3-none-any.whl

Download URL image2excel-1.0.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d954b2833e0f76d201973f944be43a5cab733c4e70fe2728024ced24e1fed8e5
BLAKE2b-256 checksum
How to use checksums
eb764d9384ab4dc700909584847abef2cd4e3b3de5396e4c46489f6d7f6b426c
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page