generate-alt-random: emit multiple sixel bands

This ensures we’re getting the ‘$’ command PGO:d
This commit is contained in:
Daniel Eklöf 2021-03-07 17:31:42 +01:00
parent ae86043780
commit f8e51fcb17
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -165,7 +165,7 @@ def main():
# The sixel 'alphabet' # The sixel 'alphabet'
sixels = '?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~' sixels = '?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
for _ in range(200): for _ in range(100):
# Offset image # Offset image
out.write(' ' * (random.randrange(cols // 2))) out.write(' ' * (random.randrange(cols // 2)))
@ -188,17 +188,24 @@ def main():
out.write(f'"1;1;{six_width};{six_height}') out.write(f'"1;1;{six_width};{six_height}')
for row in range(six_height // 6): # Each sixel is 6 pixels for row in range(six_height // 6): # Each sixel is 6 pixels
# Choose a random color band_count = random.randrange(32)
out.write(f'#{random.randrange(256)}') for band in range(band_count):
# Choose a random color
out.write(f'#{random.randrange(256)}')
if random.randrange(2): if random.randrange(2):
for col in range(six_width): for col in range(six_width):
out.write(f'{random.choice(sixels)}') out.write(f'{random.choice(sixels)}')
else: else:
out.write(f'!{six_width}{random.choice(sixels)}') out.write(f'!{six_width}{random.choice(sixels)}')
# Next line # Next line
out.write('-') if band + 1 < band_count:
# Move cursor to beginning of current row
out.write('$')
elif row + 1 < six_height // 6:
# Newline
out.write('-')
# End sixel # End sixel
out.write('\033\\') out.write('\033\\')