In Python the string:
a = '00001111\n00110011\n00110101\n.....'
How would I convert that to an image of let’s say 8×8 pixels where 0 stands for black and 1 stands for white. Is the route to study for example BMP and make a BMP file from it. Or are there smoother roads to enlightenment?
The first step is to convert your string to a sequence of bytes containing the proper values:
Then use PIL’s
Image.fromstringto convert it to an image: