Convert a graphics image to a spreadsheet?
Yes, that's exactly what this VBA macro does.
One day I was writing a routine in C to read and convert images for another program I was working on. Somehow I noticed a similarity in the BMP (bitmap) format of each pixel with Excel cells in a spreadsheet. So I started fiddling around a bit and wrote this small routine to display a BMP file in Excel, using a cell for each pixel.
For this to work, simply save a bitmap file in the same directory as the xls-file with the name SAMPLE.BMP There are some limitations though:
- only uncompressed bmp files (but compressed bmp files are very rare)
- only 24-bit color files
- maximum width 255 pixels (Excel limitation of number of columns)
- maximum height 1000 pixels (just to make it managable)
Excel does have some serious limitations when it comes to use of colors - but depending on the picture the result can be reasonable!
Have fun with this one!
You can download BMP to XLS conversion (including a sample bitmap file) here.
You can get in touch with me from this page.