1jp2a(1) USER COMMANDS jp2a(1)
2
3
4
6 jp2a - convert JPEG images to ASCII
7
9 jp2a [ options ] [ filename(s) | URL(s) ]
10
12 jp2a will convert JPEG images to ASCII characters. You can specify a
13 mixture of files and URLs.
14
16 - Read JPEG image from standard input
17
18 --background=light --background=dark
19 If you don't want to mess with --invert all the time, just use
20 these instead. If you are using white characters on a black
21 display, then use --background=dark, and vice versa.
22
23 -b --border
24 Frame output image in a border
25
26 --chars=...
27 Use the given characters when producing the output ASCII image.
28 Default is " ...',;:clodxkO0KXNWM". --colors Use ANSI color
29 for text output and CSS color for HTML output.
30
31 -d --debug
32 Print debugging information when using libcurl to download
33 images from the net.
34
35 -f --term-fit
36 Use the largest dimension that makes the image fit in your ter‐
37 minal display.
38
39 --term-height
40 Use terminal display height and calculate width based on image
41 aspect ratio.
42
43 --term-width
44 Use terminal display width and calculate height based on image
45 aspect ratio.
46
47 -z --term-zoom
48 Use terminal display width and height.
49
50 --fill When used with --html and --color, then color each output char‐
51 acter's background color. For instance, if you want to use
52 fill-output on a light background, do
53
54 jp2a --color --html --html-fill --background=light somefile.jpg
55 --output=dark.html
56
57 To do the same on a light background:
58
59 jp2a --color --html --html-fill --background=dark somefile.jpg
60 --output=light.html
61
62 The default is to have fill disabled.
63
64 -x --flipx
65 Flip output image horizontally
66
67 -y --flipy
68 Flip output image vertically
69
70 --height=N
71 Set output height. If only --height is specified, then output
72 width will be calculated according to the source images aspect
73 ratio.
74
75 -h --help
76 Display a short help text
77
78 --grayscale
79 Converts image to grayscale when using --html or --colors.
80
81 --html Make ASCII output in strict XHTML 1.0, suitable for viewing with
82 web browsers. This is useful with big output dimensions, and
83 you want to check the result with a browser with small font.
84
85 --html-fill
86 Same as --fill. You should use that option instead.
87
88 --html-no-bold
89 Do not use bold text for HTML output.
90
91 --html-raw
92 Output only the image in HTML codes, leaving out the rest of the
93 webpage, so you can construct your own.
94
95 --html-fontsize=N
96 Set fontsize when using --html output. Default is 4.
97
98 --html-title=...
99 Set HTML output title.
100
101 --output=...
102 Write ASCII output to given filename. To explicitly specify
103 standard output, use --output=-.
104
105 -i --invert
106 Invert output image. If you view a picture with white back‐
107 ground, but you are using a display with light characters on a
108 dark background, you shoudl invert the image.
109
110 --red=...
111
112 --green=...
113
114 --blue=...
115 When converting from RGB to grayscale, use the given weights to
116 calculate luminance. These three floating point values must add
117 up to exactly 1.0. The default is red=0.2989, green=0.5866 and
118 blue=0.1145.
119
120 --size=WIDTHxHEIGHT
121 Set output dimension.
122
123 -v --verbose
124 Print some verbose information to standard error when reading
125 each JPEG image.
126
127 --width=N
128 Set output width. If you only specify the width, the height
129 will be calculated automatically.
130
131 -V --version
132 Print program version.
133
134 --zoom Sets output dimensions to your entire terminal window, disre‐
135 garding source image aspect ratio.
136
138 jp2a returns 1 when errors are encountered, zero for no errors.
139
141 Convert and print imagefile.jpg using ASCII characters in 40 columns
142 and 20 rows:
143
144 jp2a --size=40x20 imagefile.jpg
145
146 Download an image off the net, convert and print:
147
148 jp2a http://www.google.com/intl/en/logos/easter_logo.jpg
149
150 Output picture.jpg and picture2.jpg, each 80x25 characters, using the
151 characters " ...ooxx@@" for output:
152
153 jp2a --size=80x25 --chars=" ...ooxx@@" picture.jpg picture2.jpg
154
155 Output image.jpg using 76 columns, height is automatically calculated
156 from aspect ratio of image.jpg
157
158 cat image.jpg | jp2a --width=76 -
159
160 If you use jp2a together with ImageMagick's convert(1) then you can
161 make good use of pipes, and have ImageMagick do all sorts of image con‐
162 versions and effects on the source image. For example:
163
164 convert somefile.png jpg:- | jp2a - --width=80
165
166 Check out convert(1) options to see what you can do. Convert can han‐
167 dle almost any image format, so with this combination you can convert
168 images in e.g. PDF or AVI files to ASCII.
169
170 Although the default build of jp2a includes automatic downloading of
171 files specified by URLs, you can explicitly download them by using
172 curl(1) or wget(1), for example:
173
174 curl -s http://foo.bar/image.jpg | convert - jpg:- | jp2a -
175
177 If you have compiled jp2a with libcurl(3), you can download images by
178 specifying URLs:
179
180 jp2a https://user:pass@foo.com/bar.jpg
181
182 The protocols recognized are ftp, ftps, file, http, https and tftp.
183
184 If you need more control of the downloading, you should use curl(1) or
185 wget(1) and jp2a read the image from standard input.
186
187 jp2a uses pipe and fork to download images using libcurl (i.e., no exec
188 or system calls) and therefore does not worry about malevolently for‐
189 matted URLs.
190
192 You can extract the red channel by doing this:
193
194 jp2a somefile.jpg --red=1.0 --green=0.0 --blue=0.0
195
196 This will calculate luminance based on Y = R*1.0 + G*0.0 + B*0.0. The
197 default values is to use Y = R*0.2989 + G*0.5866 + B*0.1145.
198
200 The latest version of jp2a and news is always available from
201 https://github.com/cslarsen/jp2a
202
204 cjpeg(1), djpeg(1), jpegtran(1), convert(1)
205
207 jp2a does not interpolate when resizing. If you want better quality,
208 try using convert(1) and convert the source image to the exact output
209 dimensions before using jp2a.
210
211 Another issue is that jp2a skips some X-pixels along each scanline.
212 This gives a less precise output image, and will probably be corrected
213 in future versions.
214
216 Christian Stigen Larsen <csl@csl.name>
217
218 jp2a uses jpeglib to read JPEG files. jpeglib is made by The Indepen‐
219 dent JPEG Group (IJG), who have a page at http://www.ijg.org
220
222 jp2a is distributed under the GNU General Public License v2.
223
224
225
226version 1.0 September 4, 2006 jp2a(1)