Codebase list fwupd / fe0c83e
trivial: Actually write the BMP UX images We need to seek back to the head to read the data back... Richard Hughes 3 years ago
1 changed file(s) with 10 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
142142 make_dir(d)
143143
144144 # write PNG
145 buf_png = io.BytesIO()
146 img.write_to_png(buf_png)
145 with io.BytesIO() as io_png:
146 img.write_to_png(io_png)
147 io_png.seek(0)
147148
148 # convert to BMP
149 pimg = Image.open(buf_png)
150 buf_bmp = io.BytesIO()
151 pimg.save(buf_bmp, format='BMP')
152 with gzip.open(filename, 'wb') as f:
153 f.write(bytes(buf_bmp))
149 # convert to BMP
150 with io.BytesIO() as io_bmp:
151 pimg = Image.open(io_png)
152 pimg.save(io_bmp, format='BMP')
153 io_bmp.seek(0)
154 with gzip.open(filename, 'wb') as f:
155 f.write(io_bmp.read())
154156
155157 for lang in self.languages:
156158 #print("lang:\"%s\" string:\"%s\"" % (lang, string))