2 ms·
in https://news.ycombinator.com/item?id=35951674 https://news.ycombinator.com/item?id=35951674 you can see that with yeso i've reduced the hassle of viewing a p
by kragen 4y ago
in https://news.ycombinator.com/item?id=35951674 https://news.ycombinator.com/item?id=35951674 you can see that with yeso i've reduced the hassle of viewing a png in x-windows to ten lines of c, and you don't have to worry about terminal emulator incompatibility, interleaved background-process output, error recovery, or dithering
(you do have to worry about bugs in yeso, of which there are several)
if you don't like c, in cpython it's four lines of code with yeso
from yeso import *
w = Window('hello, world', (406, 220))
w.frame().copy(read_png('admu_shell.png'))
while True: w.wait()
this requires a little bit of tweaking to work in pypy
also it works on the linux framebuffer as well as in x-windows
not being inline is a harder problem to solve
- vidarh 4y agoBut it being inline is a critical requirement, or we'd just shell out to any of a number of image viewers. The problem isn't a lack of options for showing images, but a lack of options to show inline images. Not needing to pull in a dependency also matters. E.g. this is enough to do Sixel on a supporting terminal: echo 'G1BxIzA7MjswOzA7MCMxOzI7MTAwOzEwMDswIzI7MjswOzEwMDswIzF+fkBAdnZAQH5+QEB+fiQjMj8/fX1HR319Pz99fT8/LSMxITE0QBtcCg==' | base64 -d Or e.g (I have no idea if this will survive HN's comment parsing, but it's the output of base64 decoding the above in single quotes): printf '\ePq#0;2;0;0;0#1;2;100;100;0#2;2;0;100;0#1~~@@vv@@~~@@~~$#2??}}GG}}??}}??-#1!14@\e\\\n' Having other options is great, but then don't remove the desire to have something really basic as well.
- kragen 4y agoyes, i agree