smeargle.py: Add undeduplicated output.
parent
ec58ad2d1d
commit
14df5514fe
21
smeargle.py
21
smeargle.py
|
@ -65,6 +65,7 @@ def main():
|
|||
os.mkdir('output')
|
||||
script_base = 'output/' + script_base
|
||||
output = script_base + '.png'
|
||||
output_full = script_base + '_full.png'
|
||||
output_raw = script_base + '.bin'
|
||||
|
||||
print('Loading font information...')
|
||||
|
@ -112,6 +113,7 @@ def main():
|
|||
|
||||
print('Text rendered. Generating tilemap...')
|
||||
tilemap = {}
|
||||
tileset = []
|
||||
tilemap_index = {}
|
||||
counter_unique = 0
|
||||
counter_total = 0
|
||||
|
@ -136,6 +138,8 @@ def main():
|
|||
tilemap_index[data] = '0x{:02x}'.format(counter_unique)
|
||||
counter_unique += 1
|
||||
|
||||
tileset.append(tile)
|
||||
|
||||
text_tiles.append(tilemap_index[data])
|
||||
|
||||
counter_total += 1
|
||||
|
@ -169,5 +173,22 @@ def main():
|
|||
file = QPixmap.fromImage(image)
|
||||
file.save(output, 'PNG')
|
||||
|
||||
print('Rendering undeduplicated tiles...')
|
||||
image = QImage(width * 16, ceil(len(tileset) / 16) * height, QImage.Format_RGB32)
|
||||
image.fill(filler)
|
||||
painter.begin(image)
|
||||
(row, column) = (0, 0)
|
||||
for tile in tileset:
|
||||
painter.drawImage(column, row, tile)
|
||||
if column < (width * 15):
|
||||
column += width
|
||||
else:
|
||||
column = 0
|
||||
row += height
|
||||
painter.end()
|
||||
image = image.convertToFormat(QImage.Format_Indexed8)
|
||||
file = QPixmap.fromImage(image)
|
||||
file.save(output_full)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue