PEP8 radio/util/img2lbm.py
Fix whitespace
This commit is contained in:
+11
-8
@@ -8,7 +8,16 @@ from PyQt4 import Qt, QtGui
|
||||
image = QtGui.QImage(sys.argv[1])
|
||||
width, height = image.size().width(), image.size().height()
|
||||
|
||||
|
||||
def writeSize(f, width, height):
|
||||
if lcdwidth > 255:
|
||||
f.write("%d,%d,%d,%d,\n" % (width % 256, width // 256, height % 256, height // 256))
|
||||
else:
|
||||
f.write("%d,%d,\n" % (width, height))
|
||||
|
||||
|
||||
f = open(sys.argv[2], "w")
|
||||
|
||||
lcdwidth = int(sys.argv[3])
|
||||
|
||||
if len(sys.argv) > 4:
|
||||
@@ -19,12 +28,6 @@ else:
|
||||
what = s
|
||||
break
|
||||
|
||||
def writeSize(f, width, height):
|
||||
if lcdwidth > 255:
|
||||
f.write("%d,%d,%d,%d,\n" % (width%256, width//256, height%256, height//256))
|
||||
else:
|
||||
f.write("%d,%d,\n" % (width, height))
|
||||
|
||||
if what == "1bit":
|
||||
rows = 1
|
||||
if len(sys.argv) > 5:
|
||||
@@ -54,14 +57,14 @@ elif what == "5/6/5/8":
|
||||
pixel = image.pixel(x, y)
|
||||
val = ((Qt.qRed(pixel) >> 3) << 11) + ((Qt.qGreen(pixel) >> 2) << 5) + ((Qt.qBlue(pixel) >> 3) << 0)
|
||||
# f.write("%d,%d,%d," % (val%256, val/256, Qt.qAlpha(pixel) >> 4))
|
||||
f.write("%d,%d," % (val%256, val/256))
|
||||
f.write("%d,%d," % (val % 256, val // 256))
|
||||
f.write("\n")
|
||||
elif what == "4bits":
|
||||
colors = []
|
||||
writeSize(f, width, height)
|
||||
for y in range(0, height, 2):
|
||||
for x in range(width):
|
||||
value = 0xFF;
|
||||
value = 0xFF
|
||||
gray1 = Qt.qGray(image.pixel(x, y))
|
||||
if y + 1 < height:
|
||||
gray2 = Qt.qGray(image.pixel(x, y + 1))
|
||||
|
||||
Reference in New Issue
Block a user