Giter Site home page Giter Site logo

hackerb9 / lsix Goto Github PK

View Code? Open in Web Editor NEW
3.1K 41.0 110.0 670 KB

Like "ls", but for images. Shows thumbnails in terminal using sixel graphics.

License: GNU General Public License v3.0

Shell 100.00%
sixel-graphics graphics imagemagick montage thumbnails ls files terminal terminal-graphics xterm

lsix's People

Contributors

hackerb9 avatar m-gregoire avatar saitoha avatar srlehn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lsix's Issues

Xterm Nothing Appears

Using Gentoo Linux. installed lsix by placing in file: /tmp/lsix.

I'm in a Gnome desktop. I installed xterm

`jlpoole@taurus ~/Pictures $ eix -I xterm
[I] x11-terms/xterm
Available versions: 327{tbz2} ~333 ~337 {Xaw3d +openpty toolbar truetype unicode xinerama}
Installed versions: 327{tbz2}(02:26:05 PM 12/27/2018)(openpty truetype unicode -Xaw3d -toolbar -xinerama)
Homepage: https://invisible-island.net/xterm/
Description: Terminal Emulator for X Windows

jlpoole@taurus ~/Pictures $
`

I then launch an xterm:

xterm -ti vt340 &

And then within the displayed Xterm:

screenshot from 2018-12-27 20-24-45

My /home/jlpoole/.Xresources file:

 #
 # per    
 #  https://github.com/hackerb9/lsix/blob/master/lsix
 #
 #   xterm -ti vt340
 #

 xterm*decTerminalID	:	vt340

 xterm*allowWindowOps      : False

 xterm*disallowedWindowOps : 1,2,3,4,5,6,7,8,9,11,13,18,19,20,21,GetSelection,SetSelection,SetWinLines,SetXprop

Create a github release.

First of all: thanks for lsix! It's really great.

For packaging and releasing lsix -- e.g. with package managers (like pacman and apt-get) -- a release is a must, sources can not be pulled from master, as the packagers have no control over how the master branch changes.

Luckily GitHub has their release system, for how to create releases see instructions here

Thanks, and have a great day!

ERROR: montage: delegate library support not built-in

On certain files, running lsix will still display the image but with an error message:

montage: delegate library support not built-in 'glasses.png' (XML) @ warning/profile.c/ValidateXMPProfile/1945.

How can I get rid of this error message, or at least suppress it?

xterm not being recognised as sixel supported.

Using xterm on NetBSD 9.0_STABLE. I've set .Xresources to read XTerm*decTerminalID: vt340
lsix was placed in /usr/bin as there is no /usr/local on this system. ImageMagick is also installed.

xterm recognized the script and outputs the error Error: Your terminal does not report having sixel graphics support

lsix

Neovim Terminal with hologram.nvim

Hi,

First of all, I'm aware there already was a (now closed) issue about vim support previously, I am relatively new to github, so I was unsure if I should comment on the closed issue or open a new one.

Closed issue: issues/21

Neovim currently has some plugins which allow images to be displayed, like hologram.nvim.

hologram.nvim mentions potential support for sixel graphics down the road.

Does the existence of such plugins make it possible for lsix to work inside neovims terminal in the future?

Your terminal does not report having sixel graphics support

Hello,

I have a problem since formatting my PC, lsix no longer works whereas before, it worked fine (with the Guake terminal)

I have this message displayed:

Error: Your terminal does not report having sixel graphics support.

Please use a sixel capable terminal, such as xterm -ti vt340, or
ask your terminal manufacturer to add sixel support.

You may test your terminal by viewing a single image, like so:

convert  foo.jpg  -geometry 800x480  sixel:-

If your terminal actually does support sixel, please file a bug
report at http://github.com/hackerb9/lsix/issues

Please mention device attribute codes: ^[[?65;1;9c

I did the test with xtem, the images are displayed. For convert, in guake, no return. In xterm my image is displayed.

thank you for helping me

Native Wayland support?

Hi! this looks great but I'm running native Wayland using Sway. Do you have any plans to support Wayland? If I wanted to implement that myself, where would I look?

Get this to work on MacOS

When i run this i get an error saying that the commands mapfile , montage , convert .

hope it is possible to fix this

Check for other animated formats

There is a check for gif images to only draw the first frame if no filename is given. Other animated formats such as webp fall through the cracks.

Not worked for arch linux + Konsole

Following is debug info:

 ╰─ $ lsix *.png
+ numcolors=16
+ background=white
+ foreground=black
+ width=800
+ tilesize=120
+ tilewidth=120
+ tileheight=120
+ fontsize=12
+ [[ 4 -gt 3 ]]
+ timeout=0.25
+ command -v montage
+ trap cleanup SIGINT SIGHUP SIGABRT EXIT
+ main DeepinScreenshot_select-area_20181013011712.png DeepinScreenshot_select-area_20181014150216.png DeepinScreenshot_select-area_20181014150620.png DeepinScreenshot_select-area_20181025221736.png
+ autodetect
+ stty -echo
+ IFS=';'
+ read -a REPLY -s -t 0.25 -d S -p ''
+ [[ '' == \0 ]]
+ [[ xterm-256color =~ mlterm ]]
+ [[ 16 -lt 256 ]]
+ IFS=';'
+ read -a REPLY -s -t 0.25 -d S -p ''
+ [[ '' == \0 ]]
+ IFS=';:/'
+ read -a REPLY -r -s -t 0.25 -d '\' -p '\'
\+ [[ rgb =~ ^rgb ]]
+ background='#000000000000'
+ IFS=';:/'
+ read -a REPLY -r -s -t 0.25 -d '\' -p '\'
\+ [[ '' =~ ^rgb ]]
+ IFS=';'
+ read -a REPLY -s -t 0.25 -d t -p ''
+ [[ 142 == 0 ]]
+ [[ xterm-256color =~ xterm ]]
+ [[ 800 -ge 1000 ]]
+ tilexspace=3
+ tileyspace=1
+ numtiles=6
+ [[ 4 == 0 ]]
+ resize='[120x120]'
+ imoptions='-tile 6x1'
+ imoptions+=' -geometry 120x120>+3+1'
+ imoptions+=' -background #000000000000 -fill black'
+ imoptions+=' -auto-orient '
+ [[ 16 -gt 16 ]]
+ [[ -n '' ]]
+ [[ -n 12 ]]
+ imoptions+=' -pointsize 12 '
+ '[' 4 -gt 0 ']'
+ onerow=()
+ goal=-2
+ '[' 4 -gt 0 -a 4 -gt -2 ']'
+ len=0
+ onerow[len++]=-label
++ processlabel DeepinScreenshot_select-area_20181013011712.png
++ span=15
++ echo -n DeepinScreenshot_select-area_20181013011712.png
++ sed 's|\[0]$||;'
++ tr '[:cntrl:]' '?'
++ awk -v span=15 -v ORS= '
        function halve(s,      l,h) {   # l and h are locals
            l=length(s);  h=int(l/2);
            if (l <= span) { return s; }
            return halve(substr(s, 1, h))  "\n"  halve(substr(s, h+1));
        }
        {
          if ( length($0) > span ) gsub(/\..?.?.?.?$/, "");
          print halve($0);
        }
++ sed 's|%|%%|g; s|\\|\\\\|g; s|@|\\@|g;'
        '
+ onerow[len++]='DeepinScre
enshot_sele
ct-area_201
81013011712'
+ onerow[len++]=DeepinScreenshot_select-area_20181013011712.png
+ shift
+ '[' 3 -gt 0 -a 3 -gt -2 ']'
+ len=3
+ onerow[len++]=-label
++ processlabel DeepinScreenshot_select-area_20181014150216.png
++ span=15
++ echo -n DeepinScreenshot_select-area_20181014150216.png
++ sed 's|\[0]$||;'
++ tr '[:cntrl:]' '?'
++ awk -v span=15 -v ORS= '
        function halve(s,      l,h) {   # l and h are locals
            l=length(s);  h=int(l/2);
            if (l <= span) { return s; }
            return halve(substr(s, 1, h))  "\n"  halve(substr(s, h+1));
        }
        {
          if ( length($0) > span ) gsub(/\..?.?.?.?$/, "");
          print halve($0);
        }
++ sed 's|%|%%|g; s|\\|\\\\|g; s|@|\\@|g;'
        '
+ onerow[len++]='DeepinScre
enshot_sele
ct-area_201
81014150216'
+ onerow[len++]=DeepinScreenshot_select-area_20181014150216.png
+ shift
+ '[' 2 -gt 0 -a 2 -gt -2 ']'
+ len=6
+ onerow[len++]=-label
++ processlabel DeepinScreenshot_select-area_20181014150620.png
++ span=15
++ echo -n DeepinScreenshot_select-area_20181014150620.png
++ sed 's|\[0]$||;'
++ tr '[:cntrl:]' '?'
++ awk -v span=15 -v ORS= '
        function halve(s,      l,h) {   # l and h are locals
            l=length(s);  h=int(l/2);
            if (l <= span) { return s; }
            return halve(substr(s, 1, h))  "\n"  halve(substr(s, h+1));
        }
        {
          if ( length($0) > span ) gsub(/\..?.?.?.?$/, "");
          print halve($0);
        }
        '
++ sed 's|%|%%|g; s|\\|\\\\|g; s|@|\\@|g;'
+ onerow[len++]='DeepinScre
enshot_sele
ct-area_201
81014150620'
+ onerow[len++]=DeepinScreenshot_select-area_20181014150620.png
+ shift
+ '[' 1 -gt 0 -a 1 -gt -2 ']'
+ len=9
+ onerow[len++]=-label
++ processlabel DeepinScreenshot_select-area_20181025221736.png
++ span=15
++ echo -n DeepinScreenshot_select-area_20181025221736.png
++ sed 's|\[0]$||;'
++ tr '[:cntrl:]' '?'
++ awk -v span=15 -v ORS= '
        function halve(s,      l,h) {   # l and h are locals
            l=length(s);  h=int(l/2);
            if (l <= span) { return s; }
            return halve(substr(s, 1, h))  "\n"  halve(substr(s, h+1));
        }
        {
          if ( length($0) > span ) gsub(/\..?.?.?.?$/, "");
          print halve($0);
        }
        '
++ sed 's|%|%%|g; s|\\|\\\\|g; s|@|\\@|g;'
+ onerow[len++]='DeepinScre
enshot_sele
ct-area_201
81025221736'
+ onerow[len++]=DeepinScreenshot_select-area_20181025221736.png
+ shift
+ '[' 0 -gt 0 -a 0 -gt -2 ']'
+ convert - -colors 16 sixel:-
+ montage -label 'DeepinScre
enshot_sele
ct-area_201
81013011712' DeepinScreenshot_select-area_20181013011712.png -label 'DeepinScre
enshot_sele
ct-area_201
81014150216' DeepinScreenshot_select-area_20181014150216.png -label 'DeepinScre
enshot_sele
ct-area_201
81014150620' DeepinScreenshot_select-area_20181014150620.png -label 'DeepinScre
enshot_sele
ct-area_201
81025221736' DeepinScreenshot_select-area_20181025221736.png -tile 6x1 -geometry '120x120>+3+1' -background '#000000000000' -fill black -auto-orient -pointsize 12 gif:-
+ '[' 0 -gt 0 ']'
+ read -s -t 60 -d c -p ''
+ cleanup
+ echo -n ''
+ stty echo
+ exit 0

Thanks

Environment

Arch linux + Gnome 3 + Xorg

Homebrew

Can you please tag this with a version number so Homebrew can pull it?

Flag to remove image labels

Currently lsix displays labels if I don't want to. Would be nice to add a flag like --no-labels to remove them so I'll see images only

Support OSC 8 (hyperlinks) to make previews clickable

Hi,

I really like your little tool, and I'm surprised that a shell script is sufficient for that (with help of ImageMagick).

I'd like you to consider adding hyperlink (OSC 8) support so the generated previews are clickable. This would be a great addition, what do you think?

Filenames with spaces

The script doesn't deal well with filenames that have spaces in them.

eg, I have a file named Bitbucket errors.png in the current directory...

$ lsix *.png
montage: unable to open image 'Bitbucket': No such file or directory @ error/blob.c/OpenBlob/3537.
montage: no decode delegate for this image format `' @ error/constitute.c/ReadImage/572.
montage: unable to open image 'errors.png': No such file or directory @ error/blob.c/OpenBlob/3537.
montage: unable to open image 'errors.png': No such file or directory @ error/blob.c/OpenBlob/3537.
montage: unable to open image 'climbing': No such file or directory @ error/blob.c/OpenBlob/3537.
montage: unable to open image 'climbing': No such file or directory @ error/blob.c/OpenBlob/3537.
montage: no decode delegate for this image format `' @ error/constitute.c/ReadImage/572.
montage: unable to open image 'cynefin': No such file or directory @ error/blob.c/OpenBlob/3537.
montage: unable to open image 'cynefin': No such file or directory @ error/blob.c/OpenBlob/3537.
montage: no decode delegate for this image format `' @ error/constitute.c/ReadImage/572.
montage: unable to open image '7.png': No such file or directory @ error/blob.c/OpenBlob/3537.
montage: unable to open image '7.png': No such file or directory @ error/blob.c/OpenBlob/3537.

mlterm display nothing except for a new file output named sixel:-

i use mlterm with versoin 3.9.0 as my VT on Centos 6.5, then i run ./lsix demo.jpg as well as i tested some other different kind of images like PNG or JPEG, then the terminal display nothing,except for a new file output named sixel:-, so what happened? tks a lot.

BTW: X Server was installed on my windows7 system, and i try the command display demo.jpg, it works very well.

Support for Alacritty

Alacritty is getting support soon it seems, and there is already work available for installation.
For example https://github.com/microo8/alacritty-sixel

I tested it out and the convert example works as expected. lsix however still displays an error.

Attribute code in error message: ^[[?4;6c.

Suggestion: Check for dependencies and alert user to install them.

I had to install webp, but imagemagic needs to be there, of course, and I had that. It still doesn't work on the default terminal on Linux Mint Cinnamon, showing some escape sequences and errors. I'm entering this because I think it would be a good idea to check for the binaries this depends on.

Windows WSL support

While this is likely true, it would be great to see WSL support and maybe someone has figured it out. Thanks

Error: Your terminal does not appear to support sixel graphics.

Please use a sixel capable terminal, such as xterm -ti vt340, or
ask your terminal manufacturer to add sixel support.

If your terminal actually does support sixel, please file a bug
report at http://github.com/hackerb9/lsix/issues

"unable to open image file" error on Ubuntu 20.04

Thank you for making this project.
I am on Ubuntu 20.04 platform. When I run ./lsix in sixel supported terminal, I get the following errors:

      montage-im6.q16: unable to open image `file://contents.png': No such file or directory @ error/blob.c/OpenBlob/2874.
      montage-im6.q16: unable to open image `file://test.png': No such file or directory @ error/blob.c/OpenBlob/2874.
      montage-im6.q16: unable to open image `file://test.png': No such file or directory @ error/blob.c/OpenBlob/2874.
      montage-im6.q16: missing an image filename `gif:-' @ error/montage.c/MontageImageCommand/1795.
      convert-im6.q16: no decode delegate for this image format `' @ error/constitute.c/ReadImage/560.
      convert-im6.q16: no images defined `sixel:-' @ error/convert.c/ConvertImageCommand/3258.

I use a patched rxvt-unicode which support sixel

I use this patch rxvt-unicode-sixel.patch which adds sixel support for rxvt-unicode.

scrot_20190701-044604_992x511

But when I try to use lsix it will silently crash. I do not get a warning or anything. With unpatched rxvt-unicode it will give me a warning that the terminal emulator is not supported but now when it is patched it just silently die.

scrot_20190701-050102_994x61

wsltty: Images are displayed on a single line at the top of the terminal and then disappear

When I use lsix, I would expect the images to display after my current line, and for that display to be persistent. That's not what happens. The images show up at the top of my terminal, one line at a time, "over" the text that exists there, and then disappears, leaving the terminal intact (i.e. it does not replace the text, it just displays the images like an overlay above the text).
Is this due to lsix, or is it due to my terminal?
I'm using wsltty 1.8.4 on Windows 10.

montage: unable to read font ...

When executing lsix this message shows up in the output alongside the thumbnails .

montage: unable to read font `/home/ryuuji/.local/share/fonts/siji.pcf' @ error/annotate.c/RenderFreetype/1468.

screenshot

The only thing is that I'm not using that font, the one im using is the default from xterm

Terminal not supported - Siduck76's st (sixel branch)

On Ubuntu 21.1, st (Siduck76's version sixel branch), I have used the example command to test my terminal, and it shows the image! After trying to use sixel, the command fails. Any ideas as to why this happens?

Can lsix be used in CentOS7 ?

After installed xterm and ImageMagick, lsix shows nothing about thumnail images. Anything I can do about this?
Thanks!

homebrew cask

please package your code as a homebrew cask and provide installation instructions.

paging support

Is there any way to scroll thumbnails one page at a time? If I try to pipe lsix output through more or less there is just garbage, not too surprising I guess.

transparent background?

hello and thanks for the project.

is it possible to set the montaged gallery background to transparent color? I tried setting montage "${onerow[@]}" $imoptions -background none gif:- | convert - -background 'rgba(0,0,0,0)' sixel:- but it doesn't seem to work. Does sixel not support viewing transparent background or what could be wrong?

(solution) Detect dimensions of `foot` running under Sway

When used with foot, window dimensions in lsix can be set as following:

window_width=$(swaymsg -t get_tree | jq -r '.. | (.nodes? // empty)[] | select(.'focused' and .pid) | "\(.rect.width)"')
window_height=$(swaymsg -t get_tree | jq -r '.. | (.nodes? // empty)[] | select(.'focused' and .pid) | "\(.rect.height)"')
width=$window_width

test iTerm2

iTerm2 has now sixel support gnachman/iTerm2@0d0003d.

This script should be checked if it supports this terminal too.

I personally don't have access to an Apple system.

MacOS brew issues

Testing with 'brew install lsix' and 'brew install iterm2' on latest MacOS (Darwin 20.5.0) shows that it works, but with errors.

'''
/opt/homebrew/bin/lsix: line 205: realpath: command not found
Unable to revert mtime: /Library/Fonts
'''

Lots of symbols instead of an image

Also font errors?

montage: unable to read font `helvetica' @ error/annotate.c/RenderFreetype/1383.  Y\xM]Y\UYXuiCWG@I?C#1!6?G?CG??C!4?g??O?G_#2!13?o!5?GOCBwUXq?ISHG?G?AoOcGA?iU?R_AoLa?G?OAG@@A???@C??gFpcOcIb???KNGvzvA_A?z]~sCg_~L~Kx_??ZdyHQPGogS@?o~PuFk

Imagemagick version: 7.0.8
Fish version: 3.0.1
OS: Android 6.0 armv7l (Termux)
Kernel: 3.18.19

DECSDM (private mode 80) is interpreted incorrectly

I'm fairly certain that you've got the DECSDM mode backwards. I think it is XTerm that has implemented it incorrectly, and MLterm that has it the right way around. CSI ?80l should enable sixel scrolling, and CSI ?80h should disable it.

Other terminals that match MLterm's behaviour include RLogin (you can see the source here), Tanasinn (see here), and WRQ Reflection (it's a commercial app, but you can see the documentation describing the behaviour of DECSDM here).

I suspect the misunderstanding came about because the VT330/340 manual documented DECSDM the way XTerm has currently implemented it, but I believe that was a mistake. The various VT382 manuals have it the other way around. See here, and here.

The author of Tera Term, who has a collection of DEC terminals, actually tested this on a VT330 and VT382 and reported the results here: https://twitter.com/ttdoda/status/479053314412126208

According to Google translate:

The actual machine and manual of VT382 and the actual machine of VT330 are DECSDM reset and sixel scrolling mode is enabled.

Which I understand to mean that sixel scrolling mode is enabled when DECSDM is reset.

Now I guess it's possible that everyone else is wrong about this, and XTerm is right, but all the evidence appears to point in the other direction.

lsix stops working when under tmux

(Newbie to lsix/ tmux: I tried searching for tmux and screen before filing this - Please, let me know if this is already discussed)

When I ssh into my box, the terminal identifies itself as xterm and I can run lsix.

However, when I start tmux, lsix seems to stop working. Is it because tmux actually runs a different terminal which does not support sixel or is it just some identification issue? I keep having to step out of tmux to view the image, and then back again. Am I missing something?

And thanks for the program!

gnome-terminal + vte with sixel support, but lsix not working

GNOME Terminal
Version 3.51.0 for GNOME 46
Using VTE version 0.75.0 +BIDI +GNUTLS +ICU +SIXEL +SYSTEMD

But lsix still not working despite vte provides sixel support as you can see above.
Error: Your terminal does not report having sixel graphics support.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.