A simple image viewer for video terminals capable of sixel graphics.
Quickly preview, delete, and move files. Particularly useful on remote
machines over ssh
.
It's a shell script. Just download vv to a directory in your PATH (e.g., ~/bin or /usr/local/bin) and make it executable (chmod +x vv).
- A sixel capable terminal (e.g., xterm -ti vt340).
- ImageMagick
- ncurses-bin (for tput)
- file (determine filetype by magic numbers rather than extension)
- mediainfo (quickly count number of frames in a video)
- GNU coreutils (for realpath, for deleting images to trashcan)
- curl, w3m and w3m-img for text based reverse image search
- Bash version >=5 (read bug workaround)
- sixvid & ffmpeg: so viewing a gif or mp4 will play an animation
- poppler-utils (for pdfinfo to count pages in PDF files)
- Can display any image type. (Via ImageMagick).
- Detects images by magic, not by extension.
- Shows everything in the current working directory by default.
- Loads directories recursively (default: ask; -r: always; -R: never).
- Scales down large images to fit within terminal.
- Supports "fit width" (
w
) mode; portrait pictures scroll vertically. - Can view at "100% zoom" (
1
). Cuts large picture into pieces, if necessary. - Has "best fit" (
B
), autorotate to use as much of the screen as possible. - Defaults to fast viewing [-F] to quickly preview and delete (
d
) images, or use [-f] to default to full-size (slower, highquality) view. - Hit (
v
) to view full-size (slower, highquality) for current image only, or use (f
) to toggle between fast and full-size viewing mode. - Preview size can be increased (
+
), decreased (-
), or reset (0
). - Deleted (
d
) images are moved to Trashcan (Freedesktop standard). - Can undo (
u
) last trashed file. - Rename (
r
), move (m
) and save-a-copy (s
) remember the previously used directory. - Web reverse image search (
W
). (Currently uses yandex). - Slideshow mode (
S
). - Renaming a file (
r
) uses readline for easier editing. - Rename and move default to the last directory used.
- If renaming or moving would overwrite an image with a different one, both images are shown side-by-side.
- Directories are automatically created if nonexistent when moving a file.
- Edit embedded comments (
C
). Works with JPEG, PNG, TIFF, GIF, and more. - Embedded comments can have multiple lines (use ^V^J for a new line).
- Sets xterm to use more color registers for higher quality pictures.
- Work on true DEC hardware (e.g., VT340).
- Resizes current image when terminal resizes. (SIGWINCH).
- Pixel height of preview is a multiple of the current text font height, so previews should be the right size no matter your screen resolution.
- Pixel width of preview is always the full width of the terminal.
- View videos (
v
) such as animated GIFs. (Requires 'sixvid' and ffmpeg). - Icons and small images can be zoomed in to screen size. (
z
to toggle). - Breadth first search. Images in current dir are shown before subdirs.
- Images with transparency use the terminal's background color.
- Thumbnails may be clicked on to open in your default viewer. (Requires a terminal that understands the OSC 8 escape sequence).
This is designed mainly for quickly previewing, deleting, and renaming images over an ssh connection. For that reason, fast, small, low-quality images are emphasized and deletion is a single keystroke. (Note, undeletion is also a single key).
libglib2.0-bin's gio
will be used for moving files to the Trashcan, if
it is installed, but it is not required. See the trash() and untrash()
shell functions.
Bash 4.4 had a bug where catching SIGWINCH in the middle of a normal 'read' would cause the stty to go insane. For that reason, in the main loop we use 'read -e' which uses readline and does not suffer from the bug. (Bash 5 is fine.)
ImageMagick 6.9.12 has a few issues:
-
may not support webm video.
-
has a bug where a filename that has a colon in it will not work when frame zero is selected. As a workaround, this script uses "file://$filename[0]".
-
has a bug where RGB data is not read properly from sixel image files
- Add --cat option which just splats images out as fast as possible.
- Handle genuine VT340 specially so it doesn't change foreground/background colors.
- Reconsider
v
(view just this image fullscreen) andf
(fullscreen toggle) keys. Maybe should either be modal or not. Would it help to redefineEnter
to always switch to fast mode and 'f' to always switch to fullscreen mode? - Allow file sortorder to be changed interactively instead of editing script. (modification/access time, natural sort).
- Show a quick overview of all images in the directory. (Like lsix).
- Should not show pdf, odt, xls and other slow formats by default.
- Currently prompt is less verbose if the screen width is too short, but maybe that should always be the case. Consider showing the succinct help only if a wrong key is hit.
- Implement "-1" and "-w" to default to 1-for-1 and Wide view mode.
- Consider using b9's feh key bindings.
- Allow selecting a range of images for deletion.
- imageinfo() calls ImageMagick's identify which is too slow.
- Use exiftool for property adjustments, not imagemagick which fails.
- Use an array of filenames so user can go back to previous, and so untrash won't take place of current image.
- Use vi/nethack keys. (
j
next,k
prev,h
back to parent directory,l
?) - Include mycompare.sh to interactively compare two files. (Side-by-side or A/B)
- Edit Caption, Title, Headline in IPTC, XMP
- Allow user to force white/black background. (Mainly for text pdfs). Alternately, perhaps a key to disable alpha channel would be better.
- Add a key for opening image in standard graphical viewer.
(Maybe dial
M
for mime?O
for open?) - Perhaps also allow graphical browser during reverse image search.
- Maybe use multiprocessing by converting full screen images in patches. (Added benefit, extends Xterm's default 1000x1000 limitation).
- Maybe quit immediately (batch mode) if only 1 image on command line.
This would obviate the need for b9's
sixcat
program. - PDF documents should work like a directory, asking user if they want to open and show images inside.
- CBZ, comicbook zip files should also work like directories.
- Should handle when ImageMagick dies due restrictions in /etc/ImageMagick-6/policy.xml. (For example, viewing an xcf file will often overrun the memory limit).
- Should we allow SVG and EPS which are images, but can execute code?
- Entering multiline comments are weird because you have to type
^V
^J
to create a newline. Should they pop open an editor?