File: jp2a.1

package info (click to toggle)
jp2a 1.0.6-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,252 kB
  • sloc: ansic: 1,006; sh: 895; makefile: 26
file content (211 lines) | stat: -rw-r--r-- 6,668 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
.TH jp2a 1  "September 4, 2006" "version 1.0" "USER COMMANDS"
.SH NAME
jp2a \- convert JPEG images to ASCII
.SH SYNOPSIS
.B jp2a
[
.I options
] [
.I filename(s) | URL(s)
]
.LP
.SH DESCRIPTION
.B jp2a
will convert JPEG images to ASCII characters.  You can specify a mixture of files and URLs.
.SH OPTIONS
.TP
.BI \-
Read JPEG image from standard input
.TP
.B \-\-background=light \-\-background=dark
If you don't want to mess with \-\-invert all the time, just use these instead.
If you are using white characters on a black display, then use --background=dark,
and vice versa.
.TP
.B \-b \-\-border
Frame output image in a border
.TP
.BI \-\-chars= ...
Use the given characters when producing the output ASCII image.  Default is "   ...',;:clodxkO0KXNWM".
.TP
.BI \-\-colors
Use ANSI color for text output and CSS color for HTML output.
.TP
.B \-d \-\-debug
Print debugging information when using libcurl to download images from the net.
.TP
.B \-f \-\-term\-fit
Use the largest dimension that makes the image fit in your terminal display.
.TP
.B \-\-term\-height
Use terminal display height and calculate width based on image aspect ratio.
.TP
.B \-\-term\-width
Use terminal display width and calculate height based on image aspect ratio.
.TP
.B \-z \-\-term\-zoom
Use terminal display width and height.
.TP
.B \-\-fill
When used with \-\-html and \-\-color, then color each output character's background color.  For instance,
if you want to use fill-output on a light background, do

jp2a --color --html --html-fill --background=light somefile.jpg --output=dark.html

To do the same on a light background:

jp2a --color --html --html-fill --background=dark somefile.jpg --output=light.html

The default is to have fill disabled.
.TP
.B \-x \-\-flipx
Flip output image horizontally
.TP
.B \-y \-\-flipy
Flip output image vertically
.TP
.BI \-\-height= N
Set output height.  If only --height is specified, then output width will
be calculated according to the source images aspect ratio.
.TP
.B \-h \-\-help
Display a short help text
.TP
.B \-\-grayscale
Converts image to grayscale when using \-\-html or \-\-colors.
.TP
.B \-\-html
Make ASCII output in strict XHTML 1.0, suitable for viewing with web browsers.
This is useful with big output dimensions, and you want to check the result with a browser with small font.
.TP
.B \-\-html\-fill
Same as \-\-fill.  You should use that option instead.
.TP
.B \-\-html\-no\-bold
Do not use bold text for HTML output.
.TP
.B \-\-html\-raw
Output only the image in HTML codes, leaving out the rest of the webpage, so you can construct
your own.
.TP
.BI \-\-html\-fontsize= N
Set fontsize when using \-\-html output.  Default is 4.
.TP
.BI \-\-html\-title= ...
Set HTML output title.
.TP
.BI \-\-output=...
Write ASCII output to given filename.  To explicitly specify standard output, use \-\-output=\-.
.TP
.B \-i \-\-invert
Invert output image.  If you view a picture with white background, but you are using
a display with light characters on a dark background, you shoudl invert the image.
.TP
.BI \-\-red= ...
.TP
.BI \-\-green= ...
.TP
.BI \-\-blue= ...
When converting from RGB to grayscale, use the given weights to calculate luminance.
These three floating point values must add up to exactly 1.0.
The default is red=0.2989, green=0.5866 and blue=0.1145.
.TP
.BI \-\-size= WIDTHxHEIGHT
Set output dimension.
.TP
.B \-v \-\-verbose
Print some verbose information to standard error when reading each JPEG image.
.TP
.BI \-\-width= N
Set output width.  If you only specify the width, the height will be
calculated automatically.
.TP
.B \-V \-\-version
Print program version.
.TP
.B \-\-zoom
Sets output dimensions to your entire terminal window, disregarding source image
aspect ratio.
.SH RETURN VALUES
jp2a returns 1 when errors are encountered, zero for no errors.
.SH EXAMPLES
Convert and print imagefile.jpg using ASCII characters in 40 columns and 20 rows:
.PP
.B jp2a
\-\-size=40x20 imagefile.jpg
.PP
Download an image off the net, convert and print:
.PP
.B jp2a
http://www.google.com/intl/en/logos/easter_logo.jpg
.PP
Output picture.jpg and picture2.jpg, each 80x25 characters, using the characters " ...ooxx@@" for output:
.PP
.B jp2a
\-\-size=80x25 --chars=" ...ooxx@@" picture.jpg picture2.jpg
.PP
Output image.jpg using 76 columns, height is automatically calculated from aspect ratio of image.jpg
.PP
cat image.jpg |
.B jp2a
\-\-width=76 \-
.PP
If you use jp2a together with ImageMagick's convert(1) then you can make good use of pipes,
and have ImageMagick do all sorts of image conversions and effects on the source image.  For example:
.PP
.B convert
somefile.png jpg:\- |
.B jp2a
\- \-\-width=80
.PP
Check out convert(1) options to see what you can do.  Convert can handle almost any image format,
so with this combination you can convert images in e.g. PDF or AVI files to ASCII.
.PP
Although the default build of jp2a includes automatic downloading of files specified by URLs,
you can explicitly download them by using curl(1) or wget(1), for example:
.PP
.B curl
\-s
http://foo.bar/image.jpg |
.B convert
\- jpg:- |
.B jp2a
\-
.SH DOWNLOADING IMAGES FROM THE NET
If you have compiled jp2a with libcurl(3), you can download images by specifying URLs:

.B jp2a
https://user:pass@foo.com/bar.jpg

The protocols recognized are ftp, ftps, file, http, https and tftp.

If you need more control of the downloading, you should use curl(1) or wget(1) and jp2a
read the image from standard input.

jp2a uses pipe and fork to download images using libcurl (i.e., no exec or system calls) 
and therefore does not worry about malevolently formatted URLs.
.SH GRAYSCALE CONVERSION
You can extract the red channel by doing this:

.B jp2a
somefile.jpg --red=1.0 --green=0.0 --blue=0.0

This will calculate luminance based on Y = R*1.0 + G*0.0 + B*0.0.  The default
values is to use Y = R*0.2989 + G*0.5866 + B*0.1145.
.SH PROJECT HOMEPAGE
The latest version of jp2a and news is always available from http://jp2a.sourceforge.net
.SH SEE ALSO
cjpeg(1), djpeg(1), jpegtran(1), convert(1)
.SH BUGS
jp2a does not interpolate when resizing.  If you want better quality, try using convert(1)
and convert the source image to the exact output dimensions before using jp2a.
.PP
Another issue is that jp2a skips some X-pixels along each scanline.  This gives a less
precise output image, and will probably be corrected in future versions.
.SH AUTHOR
Christian Stigen Larsen <csl@sublevel3.org> -- http://csl.sublevel3.org

jp2a uses jpeglib to read JPEG files.  jpeglib is made by The Independent JPEG Group (IJG),
who have a page at http://www.ijg.org
.SH LICENSE
jp2a is distributed under the GNU General Public License v2.