INNER CODE UNIT · Python

outputString

Hykudoru/Pescado-Engine-Embedded-ESP32S3 · lib/TFT_eSPI-2.5.34/Tools/bmp2array4bit/bmp2array4bit.py:192

outputString = outputString[:-2]
outputString += "\n};\n\n"
outputString += "// width is " + str(width) + ", height is " + str(height) + "\n"
outputString += "static const uint8_t myGraphic[" + str(arraySize) + "] PROGMEM = {" + '\n'

if bitsPerPixel != 4:
    print("Expected 4 bits per pixel; found {}".format(bitsPerPixel))
    sys.exit(1)
    
#Start converting spots to values
#Start at the offset and go to the end of the file
dropLastNumber = True #(width % 4) == 2 or (width % 4) == 1
paddedWidth = int(math.ceil(bitsPerPixel * width / 32.0) * 4)
debugOut("array range is {} {} len(contents) is {} paddedWidth is {} width is {}".format(offset[0], fileSize[0], len(contents), paddedWidth, width))

r = 0
width = int(width / 2)
#for i in range(offset[0], fileSize[0]):                 # close but image is upside down.  Each row is correct but need to swap columns.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…