Skip to content

Instantly share code, notes, and snippets.

@saitoha
Last active August 3, 2021 13:31
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saitoha/7546579 to your computer and use it in GitHub Desktop.
Save saitoha/7546579 to your computer and use it in GitHub Desktop.
cat sixel file with penetrating GNU Screen
% screen
% cat test.png | pngtopnm | pnmquant 256 | ppmtosixel | ./penetrate.py && cat
% cat test.png | sixelconv | ./penetrate.py && cat
#!/usr/bin/env python
from sys import stdin, stdout
while True:
s = stdin.read(512 - 8)
if not s:
break
s = s.replace("\x90", "\x1bP")
s = s.replace("\x9c", "\x1b\x1b\\\x1bP\\")
s = s.replace("\x1b\\", "\x1b\x1b\\\x1bP\\")
stdout.write("\x1bP")
stdout.write(s)
stdout.write("\x1b\\")
stdout.flush()
@bluss
Copy link

bluss commented May 3, 2021

See also img2sixel's -P option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment