Description | Download | Changes | Svgalib home

zgv

(zgv screenshot)

Description

zgv is a picture viewer with a thumbnail-based file selector, for the Linux and FreeBSD console (it uses svgalib). It's pretty featureful, and is probably the best svgalib-based viewer. (It can also be built to use SDL if you prefer.) Lots of people have told me they like it, where "lots" = "oh, it must be at least two or three", and you can't ask for a more ringing endorsement than that. Well, you could, but I'm not sure you'd get it. :-)

zgv supports most popular formats, and allows panning and fit-to-screen methods of viewing, slideshows, scaling, gamma adjustment, etc.

If you prefer to use X, you may want to check out xzgv.


Download

The current version is 5.9, here as zgv-5.9.tar.gz. It's also available from ibiblio.

WARNING: There is a known vulnerability in zgv 5.8 (and all previous versions) such that suitably-constructed images can be made to run arbitrary commands when viewed with zgv - not as root, but as the user running zgv. This still has the potential to cause serious trouble, so I strongly recommend that existing users upgrade to the current version.


Changes

This excerpt from NEWS lists the changes from zgv 5.4 onwards.

Changes in zgv 5.9

New features

Added SDL mouse support. Thanks to Dimitar Zhekov for this.


Bugfixes

Added width/height limits to all picture readers, 32767x32765 is now the maximum image size supported (essentially consistent with xzgv). This is a crude (albeit effective) fix for several reported overflow bugs, which had previously meant that zgv could be exploited to run commands as the user when viewing a maliciously-formatted file. Thanks to Luke Macken for letting me know about the problems. I suppose I should also thank "infamous41md" for publishing the original advisory/exploit, even if he didn't bother emailing me or anything.

Added more multiple-image GIF brokenness checks than before. Previously it was possible to get a segfault with the `right' file, despite there already being various range checks. Thanks to Mikulas Patocka for spotting this.

Fixed a problem with freeing memory when a GIF fails to load. Thanks to Mikulas Patocka for the fix.

Fixed a possible hang when reading GIF files with corrupted extension blocks. Thanks to Mikulas Patocka for finding this.

Fixed a possible hang when reading corrupted non-raw PBM files.

The SDL backend previously had a timer-related bug which could cause some odd problems. Thanks to Dimitar Zhekov for spotting this one.


Other changes

The `fullscreen' option now defaults to on, so you now have to use `--fullscreen=off' (or similar config file option) to disable it. This keeps the SDL backend's behaviour closer to the svgalib one.



Changes in zgv 5.8

New features

Added FreeBSD support, thanks to Radim Kolar for contributing this. Be sure to read INSTALL in full before building zgv on FreeBSD, there's a minor problem with it at the moment (nothing too horrible though :-)).

Added support for dithering in 15/16-bit modes. It's slower than I'd hoped, so it's not enabled by default, but it seems to work well enough. You can toggle it in the viewer by pressing `F', or add `dither-hicol on' to a config file. Thanks to Stephane ODUL for suggesting this.

Added `fullscreen' option, to override possible use of a windowed display with non-svgalib backends in some situations, the obvious example being the SDL backend running under X. This isn't necessarily what you'd want, and has problems like not being able to fill the screen in modes it doesn't support natively under svgalib. (And SDL can cause further problems, from what I've seen.)


Bugfixes

Fixed long-standing bug with interpolation (fix ported from xzgv). In xzgv the bug could have caused segfaults, but I don't believe this was the case in zgv due to the way it allocates memory.

Added SDL getbox routine, fixing one of the display glitches when using that (dialogs not restoring previous screen contents).

Fixed missing-picture-update bug when doing certain mode changes under SDL.

The SDL backend will now only ever use SDL's non-native-depth mode emulation for 8-bit modes. This should improve picture quality when only 8-bit modes are available, and make all modes other than 24/32-bit quite a bit faster. Thanks to David Matthews for inspiring this change.

The SDL backend is now a lot more sensible about automatically picking a file selector mode, and should have a better chance of working when using a single-mode VESA framebuffer. Thanks to David Matthews for indirectly spotting this problem.

Added timer start/stop to backend code, so now timer-based stuff (most notably GIF animation) works ok under SDL.

Fixed colour glitches in dialogs under SDL.


Other changes

Finally changed default installation prefix to /usr/local. `make install' now removes any old version (both program and documentation) in the old default locations.

Removed embedded LFs from src/bdf2h.c, which were causing compilation errors with newer versions of gcc. Not strictly a bug - blame the gcc folks :-), though to be fair there had been plenty of advance warning. Thanks to Dimitar Zhekov for the patch.

Moved `fake-cols' toggle key from `F' to `G'.

Removed support for a repeat-timer setting of "-1" (i.e. constantly reload the image), which had been broken previously anyway.

`x' now aborts GIF animation like Esc does. Thanks to Thomas M. Ott for pointing out the inconsistency. Note that I don't consider supporting this slightly pointless alternative to Esc to be terribly important (e.g. dialogs don't support it and never have, and they've been in zgv since 1993), and couldn't add it everywhere even if I wanted to (e.g. change-to-arbitrary-directory dialog).



Changes in zgv 5.7

New features

Added support for display backends other than svgalib; currently SDL is supported. (There are still problems with this - e.g. graphical glitches with dialog boxes, and broken GIF animation - but it seems to be mostly working.) Alternative backends are by definition never going to be *better* than native svgalib, but if you somehow can't use svgalib then at least this gives you a way of running zgv. Note that you have to compile a separate zgv executable for each backend, and only the svgalib one is compiled by default.

New `--auto-mode-fit-diff' option, allows you to specify a pixel width/height to be disregarded when zgv picks a mode to use and auto-mode-fit is enabled. So e.g. a 330x250 image would be shown in 320x240 mode if auto-mode-fit-diff is 10. Thanks to Dimitar Zhekov for this.


Bugfixes

32-bit modes can now be specified on the command-line (they couldn't previously). Thanks to "kscott" for spotting this one.

Fixed mouse cursor appearance in 32-bit modes. Thanks to Dimitar Zhekov for the patch.

No longer sets background colour to black for 1-bit mono PNG files, where this sometimes caused problems. Thanks to Morten Bo Johansen for spotting this.


Other changes

Restored documentation for `-r', `-s', and `-w' options, which was mistakenly dropped when I added long-option support.



Changes in zgv 5.6

New features

New `-A' or `--auto-animate' option, forces the viewer to automatically animate multiple-image GIF files. Thanks to John Fitzgerald for suggesting this (more or less). It limits your viewing options greatly, of course (since it's like pressing `e' every time you view one, and exiting the image when you exit the animation), but can be handy for slideshows etc. When this option is enabled, you can use Backspace/Enter/Space for file navigation/tagging during an animation. (The skip-to-next-frame key (previously Enter) is now `n'.)

Added multi-file delete. This is on `D', by analogy with `C' and `M' for copy/move (since it works the same way) - the single-file-only delete remains available on the Delete key. A new config variable `delete-tagged-prompt' says whether to prompt before deleting all tagged files (enabled by default). Thanks to Max Drozdoff for prodding me into action on this. :-)


Bugfixes

In the very unusual case of both global and local GIF colourmaps being present, they were applied in the wrong order. Thanks to Michal Svec for spotting this.

Should now support 16-bit RGB TGA files. 16-bit palette-based files *may* also work now, but are untested - it's not all that easy to find samples of these rather unusual types of TGA file. Thanks to Michal Svec for spotting the problem.

If a 32-bit mode existed without a corresponding 24-bit mode, and it was one of the modes which are listed on the viewer right-button menu, then it was incorrectly `greyed out', i.e. made unavailable from the menu. Thanks for Dimitar Zhekov for spotting this.

When using `delete-single-prompt off', it previously didn't update the screen after the deletion. Thanks to Max Drozdoff for spotting this one.


Other changes

Added 15/16/24/32-bit 320x240 modes. Thanks to Michal Svec for suggesting this. Currently only the 24/32-bit mode is selectable directly (using `^', on the assumption that it's shift-6 - unshifted 6 selects 320x240x8).

Removed `--version-svgalib' option, this was causing trouble when compiling with old versions of svgalib.



Changes in zgv 5.5

New features

Recursive thumbnail update, ported from xzgv. This updates thumbnails for the current dir and all subdirs (being careful to avoid symlink loops).

The selector looks different in various ways. Most obviously, the logo is gone (replaced with a sort of `title bar' with similar content to xzgv's), the scrollbar is enabled by default, and 20 thumbnails are visible by default rather than 12 - but there are other changes, like losing the `raised border' look in most cases, and buttons looking roughly like they do in GTK+.

GIF animation speed is now much, much more accurate; it previously tended to run rather slowly.

Now supports GIF animation with the same orientation as the normal picture. So for example you can flip the picture, and the animation will be of similarly flipped frames.

The file info dialog (on `:') is much improved - it's now roughly the same as the one in xzgv.

Added GNU-style long-option support, and changed/reorganised config file option names to suit this; see `Invoking zgv' in info file or `OPTIONS' in man page. Essentially things are a lot more xzgv-like now (and just about everything can be messed about with on the command-line). Note that most old option names are still supported in config files, so it shouldn't break things.

Optional black background in 8-bit modes, disabled by default (use the `black-background' config file option to enable). It works by swapping the nearest-to-black palette index with the zero index, and altering the in-memory image to match. This can be rather nice for consistency with high-colour images, but means that 8-bit images which need such a `fix' will take longer to appear.


Bugfixes

Fixed three buffer overruns. Given the nature of these, I suspect they weren't exploitable for a DoS (i.e. leaving the console in graphics mode), but it's difficult to be certain.

More BMP fixes - thanks to Jakub Bogusz for most of these.

Finally generates correct height comment for animated GIFs. (Be sure to remove any old `.xvpics' dir if you want to fix this for existing files.)

GIF animation with zoom mode enabled no longer pointlessly clears the screen for each frame.

It previously drew entire pixel lines unnecessarily for images which remained smaller than the screen width when scaled up.

It didn't previously do the required redraw when toggling fakecols (with `F') when in 16-colour mode.

No longer undraws/redraws scrollbar unnecessarily during thumbnail update.

The progress report bar now says "Reading" rather than "Decompressing". At last. :-)


Other changes

Message boxes can now pop up over the existing viewer screen in most cases (i.e. in any mode which is 640x480 or higher and has 256 or more colours), using much the same approach as the mouse menu does. This means that e.g. doing `:' in the viewer to get file info generally doesn't need a mode switch any more.

The old `fullsel', `hicolmodes', and `hicontrol' settings have been dropped, as they're now obsolete. You get a warning if you try to use them.

The `centre' setting can no longer be toggled on the command-line with the `-c' option. (You can use `--centre=off' if you still want to disable this from the command-line.)



Changes in zgv 5.4

New features

Added equivalent of xzgv's zoom-reduce-only option, which lets you reduce big pictures in zoom mode without it also enlarging small ones. The toggle is on Alt-r, and the config file option is `zoom_reduce_only'. Thanks to Jan Blasiak for this.

You can now optionally use a magic-number-based scheme to choose which files to list in the selector (Alt-m toggles it, and `fsmagic' is the relevant config file option). This approach is much slower, but useful when you have files lacking extensions. Thanks to Dankó Miklós for suggesting this.

Added optional error-diffused dithering in 640x480x4 mode (enable with Alt-c or `fastdither16col off' in config file) - this usually looks better, but is much too slow to be the default.


Bugfixes

A fix for `restore to background colour' replacement method in animated GIFs - it previously trusted the left/top/width/height values for the GIF images to be sane (i.e. to fit within the defined `screen'), which was a pretty stupid mistake. Thanks to Michal Svec for spotting the problem.

Several significant BMP-reading fixes, particularly affecting some 16-colour and 24-bit files. Thanks to Matan Ziv-Av and Vlad Harchev for spotting the problems.

Previously, when you deleted a file, or a file-move wasn't successful, all tags were lost. This could be extremely annoying at times, but it's finally fixed. Thanks to Dankó Miklós for reminding me about this one (I'd noticed it before).

Animated GIFs now have thumbnails showing only the first image, though the current implementation is... less efficient than it could be (it reads the lot, then ignores everything after the first :-)).

The 640x480x4 (16-colour) mode-select key was still listed as `4' on the mode help page, when it's been `0' for a while. (A similar problem with the mouse menu meant the 640x480x4 option on that wasn't working, either.) Thanks to Wim Osterholt for spotting this.


Other changes

Improved 640x480x4 mode's colour dithering slightly, and changed so it now transparently adjusts base gamma adjustment (without changing the effect of user-specified gamma). Essentially, it tends to look a bit more like it does in proper 8-bit modes now. :-)

The GIF reader didn't previously read a certain form of broken animated GIF (those with multiple image block terminators, which breaks the GIF spec) - it stopped after one image. This was *not* a bug, but it now tolerates such bogosity anyway. Thanks to Daniel Biddle for spotting this.

Now allows `1' and `0' as alternatives to `on'/`off' and `yes'/`no' for boolean option setting in config files. Also made the documentation a bit clearer about how bools can be set. Thanks to Johannes Zellner for indirectly noticing the problem.

The man page's OPTIONS section now has the right name again.


Last updated on 2005 Feb 12