How to create a pixelated photo in Excel

The idea of ​​this tutorial is to take any image and paint the Excel cells accordingly.

An image is just a rectangle divided into squares (the pixel), and each pixel is colored with a color.

Imagine that each cell is painted a combination of Red, Green and Blue, the primary colors.

Each cell will have a shade of these colors, and this shade ranges from 0 to 255.

Unfortunately, VBA does not have a good image manipulation library. I recommend installing OpenCV (open computer vision) in Python.

The routine has two steps:

1 — read the image and save the data matrix (Python)

2 — read the data matrix and color Excel

Step 1) Run the file “”, in Python.

Indicate the location of the image file to be drawn

Change the location of the destination CSV file.

This routine reads the image and saves the data matrix in CSV.

Step 2) Run the Excel “Pixeliza” macro attached. It is necessary to change the address of the CSV file.

And now, we have a reproduction of the image in the spreadsheet, which can be edited normally, like any Excel file.

Attention. Running this macro, I found that Excel has a limit of 4000 cells with different formatting.

Worse, it easily reaches that limit.

Therefore, the mentioned tutorial only works with very low resolution images.

See files on Github:

There is Excel with the macro and Python code.

Technical ideas with a bit of philosophy

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store