View Single Post
Old 08-12-2018, 06:13 PM   #27
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Hmmm, a higher horizontal resolution means a different data type (here, uint32_t instead of uint8_t), which is moderately more annoying to handle...

But other than that, yeah, that works.

Code:
row="........########................"
row.replace('.', '0')
row.replace('#', '1')
hex = '%0*X' % ((len(row) + 3) // 4, int(row, 2))

00FF0000

Last edited by NiLuJe; 08-12-2018 at 07:39 PM.
NiLuJe is offline   Reply With Quote