Debian Codegraph @

asciiview

raw ◀ ▶
Source reconstructed at patch state 1 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 #!/bin/bash
2 # asciiview - an ascii art image browser script. Front end for aview/aaflip
3 clear()
4 {
5 kill $! 2>/dev/null
6 rm -f /tmp/aview$$.pgm 2>/dev/null
7 }
8 myconvert()
9 {
10 if anytopnm "$1" >/tmp/aview$$.pgm 2>/dev/null ; then
11 exit
12 elif convert -colorspace gray "$1" pgm:- 2>/dev/null ; then
13 exit
14 fi
15 echo "Failed to convert file format to PNM by both convert and anytopnm" >&2
16 while true; do
17 echo "0 "
18 done
19 }
20 filenames=""
21 options=""
22 if [ "$1" = "" ]; then
23 echo "$0 - an ascii art image/animation browser.
24
25 To run this script you need aview, aaflip and NetPBM or ImageMagick.
26 You may browse any graphics format supported by NetPBM or ImageMagick
27 and .fli/.flc files.
28
29 Usage:
30 $0 [options] [filenames]
31
32 type aview --help [enter] for list of options.
33 "
34 exit 1
35 fi
36 counter=0
37 while [ "$1" != "" ]; do
38 case "$1" in
39 "-font" | "-driver" | "-kbddriver" | "-mousedriver" | "-*width" | "-*height" | "-bright" | "-contrast" | "-gamma" | "-random" | "-dimmul" | "-boldmul")
40 options="$options $1 $2"
41 shift
42 shift
43 ;;
44 -*)
45 options="$options $1"
46 shift
47 ;;
48 *)
49 filenames[$counter]="$1"
50 counter=$(($counter+1))
51 shift
52 ;;
53 esac
54 done
55 trap clear 0
56 mkfifo /tmp/aview$$.pgm
57 outfile=/tmp/aview$$.pgm
58 while [ $counter -gt 0 ]; do
59 counter=$(($counter-1))
60 name=${filenames[$counter]}
61 if test -r "$name" ; then
62 case "$name" in
63 *.fli | *.lfc | *.flic )
64 PATH="$PATH:."
65 aaflip $options "$name"
66 ;;
67 *)
68 myconvert "$name" >/tmp/aview$$.pgm &
69 pid=$!
70 PATH="$PATH:."
71 aview $options /tmp/aview$$.pgm
72 kill $pid 2>/dev/null
73 esac
74 else
75 echo "The file '$name' could not be opened."
76 fi
77 done