When I started the series of posts on console tools for PDF files, I had another computer, and it handled graphics from the console differently.
The chipset on the old computer was directly supported by SVGAlib and everything was working fine as far as I was concerned.
When I upgraded to the current computer I found many of the graphics programs I was using needed to be shifted over to using frame buffer drivers or versions, as the video chipset on this PC seemed to be marginally (or in some instances brittly) supported in Linux.
In some instances this was a gain, one example being w3m, which I can if so choosing run as a graphical web browser.
In a couple of instances, zgv and svncviewer, I had to do without a console program and use an X program.
zgv is one of the more amazing graphic applications that run from the raw console in Linux.
Perhaps even more amazing than watching videos in a naked command line interface.
It is an image viewer that can be used on single images, slide shows, or a directory of image files, handling most of the formats we are familiar with.
It has some simple image processing capabilities, and when navigating a directory of images, can generate thumbnails of all the images and can present a graphical navigation interface with these thumbnails.
The alternate viewer 'fbi' (Frame Buffer Imageviewer) if fine, but to date simply lacks some of the many capabilities of zgv.
I first encountered zgv as a default image viewer for text browsers such as Lynx and w3m.
It's been over a year since I got the new computer, and the other morning, I decided to try to see if there was some way to revive use of zgv. It never failed to run, but in maybe half the images colors were distorted beyond reasonable use - something like solarization of color phototgraphic film - great if you want an LSD/Timothy Leary effect but not for daily use.
In the SVGAlib configuration file, I'd hardcoded use of the framebuffer driver (as opposed to SVGAlib choosing one of the supported chipsets) by uncommenting the line:
chipset FBDEV # Use kernel fbdev, instead of direct hardware.
in the file /etc/vga/libvga.config.
With this, applications that use SVGAlib will now indirectly use the video framebuffer.
I rummaged around a bit through the zgv man pages, trying various things.
One clue I searched on to see if there was something that might get it working consistently was the word 'force'.
My notion was that perhaps something was being misinterpreted by the program and it 'forcing' some initial condition might solve the problem.
I finally found a switch '--force-viewer-8bit' (or briefly '-j') that seems to do the trick.
No solarization effects.
It may be that some images could be displayed with greater sharpness or color accuracy, '8bit' throwing away parts of 16/24 bits of pixel information, but everything *looks* reasonable.
Nothing is reduced to psychedelic poster (or even comicbook) appearence.
The worst thing I've encountered so far is that after looking at information on the image file sometimes I need to refresh the display with a CTL-L or CTL-R, but this is a minor point.
To make this default behaviour, edit the file /etc/zgv.conf and add the line:
force-viewer-8bit on
A few other settings I include in the file (you can look them up in the man page) are:
zoom on
centre on
auto-mode-fit on
jpeg-speed 1
mousescale 2.0
mouse on
block-cursor on
fs-perfect-cols on
jpeg-index-style 3
fs-thick-text on
A couple that apparently must be left out of the configuration file and placed among command line switches are:
# show-dimensions on
# reload-delay 1000000
# - fatal in this file
A few of the more important commands of zgv:
? - help
ESC - return to previous mode (eventually exiting)
Enter - go to the next image
v - toggle file selector mode between graphical or text
/ - help for video modes available
: - display file information
; - reset brightness/contract/etc. to default
Alt-u - generate/update thumbnail images
Ctrl-I - start a slide show of files tagged in file selector mode.
Ctrl-R - refresh view/directory
Ctrl-L - refresh view/directory
Right Mouse button - context sensitive menu
Left Mouse button - select an image or directory in file selector/directory view mode
You can navigate the file selector or large images with cursor, vi or (what I think are) WordStar keys.
I leave exploring the various zooming, rotating, mirroring, flipping, contrast, brightness, gamma, rendering and file tagging capabilities to you, the reader.
The ironic reality is that using this as the viewer for a text mode web browser, the surfer has more control over image viewing than any I've encountered with so called graphical web browsers.
A few of the command line switches can be of use.
The '--reload-delay 100000' mentioned above effectively sets the default slide show interval to totally at the users decision to move on, instead of the default 4-sec.
'--show-dimensions' (or -s) causes zgv to print the dimensions of displayed files to standard out, perhaps to pass on to some program for image processing.
'-T' causes zgv to print the names of tagged files to standard out, where they could (for instance) be passed on via a script to CUPS and printed out, or copied/moved to a holding directory.
And this really is the tie-in with these article with on .pdf.
After using ghostscript to convert the pages of a pdf document to images,
you can browse through them with zgv in file selector mode, tag some, and have them printed out.