top of page

How to Turn Any Photo into an Excel Portrait

  • 2 days ago
  • 3 min read
Original photo next to a colored Excel portrait made from conditional formatting and cell shading.

I recently made a self portrait in Excel by turning a photo into a grid of shaded cells. The idea is simple: every cell becomes one pixel, and Excel’s conditional formatting turns the numbers into a colored image.


Contents:

1. Downloads

2.2. Step By Step Instructions



Download

All you'll need is this Python file. To install python


If you do not already have Python installed, download it here: Python.org


After installing Python, you may need to install the image library used by the script. Open Command Prompt or Terminal and run:

pip install pillow

Then you can run the file with:

python Self_Portrait_Conversion.ipynb

On some computers, you may need to use:

python3 Self_Portrait_Conversion.ipynb

Instructions

How it Works

The Python script takes your image, converts it to grayscale, resizes it, and exports the brightness values into a CSV file.

Each value is between 0 and 255:

  • 0 = black

  • 255 = white

  • Everything in between becomes a shade of gray

Once the data is in Excel, conditional formatting maps those numbers to cell colors, creating the final image.


Step 1: Add Your Photo

Rename your image file to: "your_photo.jpg"

Place it in the same folder as the Python script.

For best results, use a close-up portrait with good lighting and strong contrast. Simple backgrounds work better than busy ones.


Step 2: Run the Python Script

Run the Python file.

This will create or update: "grayscale_grid.csv". The CSV contains the pixel brightness values that Excel will use to build the portrait.


Step 3: Open the CSV in Excel

Open grayscale_grid.csv in Excel.

At first, it will just look like a giant block of numbers. That is exactly what we want.

Each number represents the brightness of one pixel from your photo.


Step 4: Hide the Numbers

Select the full grid of numbers.

Then open Format Cells and go to: Number → Custom

In the custom format box, enter: "; ; ;"


This hides the numbers while keeping the actual values in the cells.

Excel still sees the numbers, but they no longer appear on the sheet.


Step 5: Add Conditional Formatting

With the grid still selected, go to:

Home → Conditional Formatting → Color Scales

conditional formatting, color scale menu

Pick a color pallet you like or make you're own!

Use something like:

  • Minimum: 0 → red

  • Maximum: 255 → green


Once applied, Excel will turn the hidden numbers into shaded cells.


Step 6: Resize the Grid

To make the image look correct, resize the rows and columns so the cells are close to squares.


You may need to experiment with the sizing depending on your screen and Excel settings.

A good starting point is:

  • Narrow column width

  • Short row height

  • Zoomed out view

The portrait will look strange up close, but once you zoom out, the image should come together.


Tips for Better Results

Use a photo with good contrast. A clear face, simple lighting, and a plain background will usually work best.

If your image looks too dark or too light, try editing the brightness or contrast of the original photo before running the script again.

You can also experiment with different grid sizes. A larger grid gives more detail, but it also creates more cells.

For example:

  • 80 × 100 = simpler, faster, more pixelated

  • 100 × 120 = good balance

  • 150 × 180 = more detailed, but heavier in Excel

Comments


bottom of page