遥控器 ota
您会记住OTA格式吗? 您可以作为SMS消息发送的简单图形格式吗? 无论如何,我在手机上找到了很酷的OTA图片,并想将其提取为“正常”图形格式,然后将其添加到
T恤衫 (它还会将图像以多个“#”写出到stdout中)
#ota2tga
def writetga(width,height,data,filename):
f = open(filename,"wb")
file = ""
file+="%c%c%c" % (0,0,2)
file+="%c%c%c%c%c" % (0,0,0,0,0)
file+="%c%c%c%c" % (0,0,0,0)
file+="%c%c" % ((width & 0x00ff)%0xff,(width & 0xff00)%0xff)
file+="%c%c" % ((height & 0x00ff)%0xff,(height & 0xff00)%0xff)
file+="%c%c" % (0x18,0x0)
for i in range(height):
for j in range(width):
file+="%c%c%c" % (data[j+(height-1-i)*(width-1)][0],data[j+(height-1-i)*(width-1)][1],data[j+(height-1-i)*(width-1)][2])
f.write(file)
f.close()
# add the name of your .ota file here.
f = open("Grafikkmelding.ota","rb")
info = ord(f.read(1))
width = ord(f.read(1))
height = ord(f.read(1))
color = ord(f.read(1))
pixmap = [[255,255,255]]*(72*28)
print width
print height
x = 0
y = 0
l = ""
for i in range(height):
for j in range(width / 8):
v = ord(f.read(1))
for k in range(8):
if( ((v >> 7-k) & 0x01) == 0):
l+=" "
pixmap[x+y*width] = [255,255,255]
else:
l+="#"
pixmap[x+y*width] = [0,0,0]
x+=1
if(x > width):
x=0
y+=1
l+="\n"
f.close()
print l
writetga(width,height,pixmap,"output.tga")
-荣誉
翻译自: https://bytes.com/topic/python/insights/872877-ota-tga-extractor
遥控器 ota