Skip to content

Commit 73b3a2f

Browse files
authored
Add files via upload
1 parent 5f04cc5 commit 73b3a2f

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

Text2BMP.exe

6.6 MB
Binary file not shown.

Text2BMP.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import os
2+
3+
text= open("text.txt")
4+
if os.path.isfile("textimage.bmp")==True:
5+
os.remove("textimage.bmp")
6+
7+
textimage= open ("textimage.bmp",'ab')
8+
text.seek(0,0)
9+
10+
headerbytes= b'BM\x8a\xc0\x12\x00\x00\x00\x00\x00\x8a\x00\x00\x00|\x00\x00\x00\x80\x02\x00\x00\xe0\x01\x00\x00\x01\x00 \x00\x03\x00\x00\x00\x00\xc0\x12\x00#.\x00\x00#.\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\x00\x00\x00\x00\xffBGRs\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
11+
textimage.write(headerbytes)
12+
13+
14+
for pixels in range (1,1600000):
15+
char=text.read(1)
16+
if char=='':
17+
text.seek(0,0)
18+
else:
19+
asciicode=ord(char)
20+
pixarray=asciicode.to_bytes(2,'big')
21+
textimage.write(pixarray)
22+
23+
text.close()
24+
textimage.close()
25+
26+

0 commit comments

Comments
 (0)