/text2bmp

C++ program to convert text into bmp images

Primary LanguageC++

Introduction

This program converts a text file into a .BMP image which if opened in a text editor displays the original text.

Example usage:

gcc -o text2bmp text2bmp.cpp
text2bmp.exe
Enter the name of file:
the last question.txt

Why?

gif

I came across this image on StackOverflow many years ago where someone drew an image in MS Paint which when opened in a text editor displayed a Hello World program. To me the whole process seemed like incomprehensible arcane sorcery back then and it practically blew my mind. Now a few years later I decided to experiment with BMP headers an afternoon, and shortly after this program was born.

Here we have a seemingly uninteresting image:

The last question.bmp

When opened in a text editor:

The last question.txt

Crikey! It was actually Isaac Asimov in disguise!