I've been using PBM files to load them on an oled (ssd1306). (reading into bytearray and framebuffer it to the screen). All my files i've been using i havent gotten any problems. Now i have a new file made (the same way i always made my pbm files) and (after some testing) i figured out that the /n (newlines) are actually /r (carriage returns). The part i use for loading the files is in an class like this:
Code: Select all
with open(self.filename + '.pbm', 'rb') as f:
f.readline()
self.sizex = int(f.readline().decode('utf8'))
self.sizey = int(f.readline().decode('utf8'))
data = bytearray(f.read())
self.image = framebuf.FrameBuffer(data, int(self.sizex), int(self.sizey), framebuf.MONO_HLSB)
Code: Select all
with open('left.pbm', 'rb') as f:
var1 = f.readline()
var2 = f.readline()
var3 = f.readline()
var4 = f.read()
print(var1)
print(var2)
print(var3)
print(var4)
Code: Select all
b'P4\r7\r7\r\x000($(0\x00'
b''
b''
b''
Code: Select all
b'P4\n'
b'7\n'
b'7\n'
b'\x000($(0\x00'