Debian Codegraph @

asciiview

raw ◀ ▶
Source reconstructed at patch state 0 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 while [ "$1" != "" ]; do
37 case $1 in
38 "-font" | "-driver" | "-kbddriver" | "-mousedriver" | "-*width" | "-*height" | "-bright" | "-contrast" | "-gamma" | "-random" | "-dimmul" | "-boldmul")
39 options="$options $1 $2"
40 shift
41 shift
42 ;;
43 -*)
44 options="$options $1"
45 shift
46 ;;
47 *)
48 filenames="$filenames $1"
49 shift
50 ;;
51 esac
52 done
53 trap clear 0
54 mkfifo /tmp/aview$$.pgm
55 outfile=/tmp/aview$$.pgm
56 for name in $filenames ; do
57 if test -r $name ; then
58 case $name in
59 *.fli | *.lfc | *.flic )
60 PATH="$PATH:."
61 aaflip $options $name
62 ;;
63 *)
64 myconvert $name >/tmp/aview$$.pgm &
65 pid=$!
66 PATH="$PATH:."
67 aview $options /tmp/aview$$.pgm
68 kill $pid 2>/dev/null
69 esac
70 else
71 echo "$name could not be opended"
72 fi
73 done