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 “OpenCVReadFile.py”, 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: https://github.com/asgunzi/FotoPixeladaExcel
There is Excel with the macro and Python code.
Technical ideas with a bit of philosophy