close

DEV Community

Cover image for Turning JPGs into Excel… because why not? 😂
Tlaloc-Es
Tlaloc-Es

Posted on

Turning JPGs into Excel… because why not? 😂

Turning JPGs into Excel… because why not? 😂

Sometimes you don’t build things because they’re useful.
You build them because you can.

This is exactly how jpg2xlsx was born.

👉 https://github.com/Tlaloc-Es/jpg2xlsx


💡 The idea

What if… instead of inserting an image into Excel…
we recreated the image using cells?

  • Each pixel → one Excel cell
  • Each cell → background color of that pixel
  • Result → Excel becomes a weird pixel-art renderer

Starting with this

Input image (a normal JPG before the chaos)

…into this 😅

Excel rendering of the image using cell colors (yes, this is Excel)

Yes, this is Excel. No, it was not designed for this.

Yes. It’s as cursed as it sounds.


🧠 How it works (simple version)

The logic is surprisingly straightforward:

  1. Load the image (PIL)
  2. Loop through every pixel
  3. Create an Excel file (openpyxl)
  4. Paint each cell with the pixel color

That’s it.

No AI. No magic. Just brute force and questionable decisions.


🎨 Example output

You take a small image…
and you get an Excel file that looks correct if you zoom out just enough.

Excel as a rendering engine was not on my bingo card, but here we are.


⚠️ The obvious problem

This approach has a tiny issue:

Excel absolutely hates this.

Let’s do some quick math:

  • 100 x 100 image → 10,000 cells ✅ OK-ish
  • 500 x 500 image → 250,000 cells 💀
  • 1920 x 1080 → don’t even try

Excel becomes slow. Then unusable. Then emotionally distant.


🛠️ The “solution”: --colores

Instead of trying to fight Excel… I cheated 😄

I added a flag:

--colores
Enter fullscreen mode Exit fullscreen mode

What it does

It reduces the number of unique colors in the image.

  • Less colors → fewer style combinations
  • Smaller file size
  • Better performance
  • Still looks “good enough”

Basically: controlled visual degradation for survival


🤔 Why this works

Excel doesn’t struggle with cells.
It struggles with too many unique styles.

So by limiting colors:

  • We reuse styles
  • We reduce memory overhead
  • We make Excel slightly less angry

🚀 Why I built this

Not for production. Not for clients.

Just for:

  • learning
  • experimenting
  • having fun
  • building weird things

And honestly… those projects are often the most fun.


⭐ If you find it funny/useful

Give it a star, it helps more than you think:

👉 https://github.com/Tlaloc-Es/jpg2xlsx


🧪 Ideas for future chaos

  • ASCII mode (Excel as terminal emulator?)
  • GIF → multiple sheets
  • Google Sheets version
  • “Minecraft mode” (limited palette)

🧾 Final thoughts

Not everything needs to scale.
Not everything needs to be useful.

Sometimes:

“This is dumb”
is exactly why you should build it.


If you’ve built something equally unnecessary, I’d love to see it 👇

Top comments (0)