Convert images into Excel spreadsheets where each cell matches a pixel color.
Project description
jpg2xlsx
Turn any image into an Excel spreadsheet where every cell becomes a pixel
Create surprisingly visual .xlsx files from JPG, PNG, BMP, GIF, and other raster images supported by Pillow.
From image to spreadsheet art
Before: a normal image
After: the same picture rebuilt as colored Excel cells
jpg2xlsx is a small Python CLI and library for generating .xlsx files from raster images. It is useful for pixel art experiments, spreadsheet demos, teaching, and weird outputs that are much more eye-catching than a normal spreadsheet should be.
Why this exists
- Converts images into native Excel workbooks.
- Works as both a CLI and an importable Python package.
- Uses a simple
src/layout,uv,ruff, tests, and GitHub Actions. - Supports JPEG, PNG, BMP, GIF, and other formats that Pillow can read.
Install
With uv
uv tool install jpg2xlsx
With pip
pip install jpg2xlsx
CLI usage
Convert an image and write output.xlsx:
jpg2xlsx input.jpg output.xlsx
If you omit the output path, the tool writes next to the input file using the same stem:
jpg2xlsx assets/pixel-cat.png
Useful options:
jpg2xlsx input.png output.xlsx --cell-width 0.18 --cell-height 1.6 --overwrite
Compact large exports
This project writes one Excel cell per image pixel. That means file size grows quickly with image dimensions.
- A
512x512image becomes262,144formatted cells. - More cells means more worksheet XML inside the
.xlsxfile. - More unique colors usually means more cell formats too.
So a large image producing a workbook around 1.5 MB is not unusual for this output model.
If you want smaller .xlsx files, reduce one or both of these before export:
- Total pixels with
--max-dimension - Color variety with
--colors
Recommended commands:
jpg2xlsx image.png output.xlsx --max-dimension 256 --colors 64
jpg2xlsx image.png output.xlsx --max-dimension 128 --colors 32
jpg2xlsx image.png output.xlsx --max-dimension 384 --colors 128
Practical guidance:
- Use
--max-dimension 128 --colors 32when file size matters more than fidelity. - Use
--max-dimension 256 --colors 64as a balanced default for big images. - Use
--max-dimension 384 --colors 128when you want to preserve more detail.
Option reference:
--max-dimension: downscales the image so its largest side matches the given value before generating the workbook.--colors: reduces the image palette to the given number of colors, from1to256.
Run help:
jpg2xlsx --help
Running in development
If you are running from the source tree, prefer module or script entrypoint execution instead of calling the package directory directly.
Correct:
uv run jpg2xlsx input.png output.xlsx
uv run python -m jpg2xlsx input.png output.xlsx
Incorrect:
uv run python src/jpg2xlsx
That direct directory execution does not establish package context correctly in Python, so relative imports can fail.
Python usage
from jpg2xlsx import convert
convert("input.jpg", "output.xlsx")
You can also use the compacting options from Python:
from jpg2xlsx import convert
convert(
"input.jpg",
"output.xlsx",
max_dimension=256,
colors=64,
)
Development
uv sync --all-groups
uv run ruff check .
uv run ruff format --check .
uv run pytest
Release flow
- CI runs lint, tests, and package builds on pushes and pull requests.
- Version bump workflows use Commitizen and update the changelog.
- Publish workflows build with
uvand upload to PyPI or TestPyPI.
Contributing
See CONTRIBUTING.md for local setup and contribution guidelines.
Security
See SECURITY.md for vulnerability reporting.
License
This project is licensed under the MIT License.
Star History
jpg2xlsx
Turn any image into an Excel spreadsheet where every cell becomes a pixel
Create surprisingly visual .xlsx files from JPG, PNG, BMP, GIF, and other raster images supported by Pillow.
From image to spreadsheet art
Before: a normal image
After: the same picture rebuilt as colored Excel cells
jpg2xlsx is a small Python CLI and library for generating .xlsx files from raster images. It is useful for pixel art experiments, spreadsheet demos, teaching, and weird outputs that are much more eye-catching than a normal spreadsheet should be.
Why this exists
- Converts images into native Excel workbooks.
- Works as both a CLI and an importable Python package.
- Uses a simple
src/layout,uv,ruff, tests, and GitHub Actions. - Supports JPEG, PNG, BMP, GIF, and other formats that Pillow can read.
Install
With uv
uv tool install jpg2xlsx
With pip
pip install jpg2xlsx
CLI usage
Convert an image and write output.xlsx:
jpg2xlsx input.jpg output.xlsx
If you omit the output path, the tool writes next to the input file using the same stem:
jpg2xlsx assets/pixel-cat.png
Useful options:
jpg2xlsx input.png output.xlsx --cell-width 0.18 --cell-height 1.6 --overwrite
Compact large exports
This project writes one Excel cell per image pixel. That means file size grows quickly with image dimensions.
- A
512x512image becomes262,144formatted cells. - More cells means more worksheet XML inside the
.xlsxfile. - More unique colors usually means more cell formats too.
So a large image producing a workbook around 1.5 MB is not unusual for this output model.
If you want smaller .xlsx files, reduce one or both of these before export:
- Total pixels with
--max-dimension - Color variety with
--colors
Recommended commands:
jpg2xlsx image.png output.xlsx --max-dimension 256 --colors 64
jpg2xlsx image.png output.xlsx --max-dimension 128 --colors 32
jpg2xlsx image.png output.xlsx --max-dimension 384 --colors 128
Practical guidance:
- Use
--max-dimension 128 --colors 32when file size matters more than fidelity. - Use
--max-dimension 256 --colors 64as a balanced default for big images. - Use
--max-dimension 384 --colors 128when you want to preserve more detail.
Option reference:
--max-dimension: downscales the image so its largest side matches the given value before generating the workbook.--colors: reduces the image palette to the given number of colors, from1to256.
Run help:
jpg2xlsx --help
Running in development
If you are running from the source tree, prefer module or script entrypoint execution instead of calling the package directory directly.
Correct:
uv run jpg2xlsx input.png output.xlsx
uv run python -m jpg2xlsx input.png output.xlsx
Incorrect:
uv run python src/jpg2xlsx
That direct directory execution does not establish package context correctly in Python, so relative imports can fail.
Python usage
from jpg2xlsx import convert
convert("input.jpg", "output.xlsx")
You can also use the compacting options from Python:
from jpg2xlsx import convert
convert(
"input.jpg",
"output.xlsx",
max_dimension=256,
colors=64,
)
Development
uv sync --all-groups
uv run ruff check .
uv run ruff format --check .
uv run pytest
Release flow
- CI runs lint, tests, and package builds on pushes and pull requests.
- Version bump workflows use Commitizen and update the changelog.
- Publish workflows build with
uvand upload to PyPI or TestPyPI.
Contributing
See CONTRIBUTING.md for local setup and contribution guidelines.
Security
See SECURITY.md for vulnerability reporting.
License
This project is licensed under the MIT License.
Star History
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 jpg2xlsx-0.2.0.tar.gz.
File metadata
- Download URL: jpg2xlsx-0.2.0.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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 |
0015d14605ad7fe47a49ad644bab29127f5af197233d6c1084d61c80d1b2047d
|
|
| MD5 |
f6e6a41df1143ef7dfa3264feeb6b045
|
|
| BLAKE2b-256 |
c8f3e2b9fe4c707cf73b6b7c616224ceb75b23fc03661cd64f36f625d04c3bbd
|
File details
Details for the file jpg2xlsx-0.2.0-py3-none-any.whl.
File metadata
- Download URL: jpg2xlsx-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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 |
d257e553d81f04766ae66223e6803bacc01de1ee34c4556aa14186ef4b83c038
|
|
| MD5 |
e0b88b1ed970c4515b4fa221da25a523
|
|
| BLAKE2b-256 |
fac87c6f3138a1595a30a6e37e280e1fd6790a8e99525d1ffa6c79ec328ea20e
|