summaryrefslogtreecommitdiff
path: root/jpeg/cdaltui.txt
blob: 702999fc1a5f3d3171fc8d82a37e99287573ad36 (plain)
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
IJG JPEG LIBRARY:  ALTERNATE USER INTERFACE FOR CJPEG/DJPEG

Copyright (C) 2020, Guido Vollbeding.
This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file.


There is an alternate command-line user interface for the IJG JPEG software.
It is designed for use under MS-DOS, and may also be useful on other non-Unix
operating systems.  (For that matter, this code works fine on Unix, but the
standard command-line syntax is better on Unix because it is pipe-friendly.)

With this user interface, cjpeg and djpeg accept multiple input file names
on the command line; output file names are generated by substituting
appropriate extensions.  The user is prompted before any already-existing
file will be overwritten.

Expansion of wild-card file specifications is useful but is not directly
provided by this code.  Most DOS C compilers have the ability to do wild-card
expansion "behind the scenes", and we rely on that feature.  On other systems,
the shell may do it for you, as is done on Unix.

Also, a DOS-specific routine is provided to determine available memory;
this makes the -maxmemory switch unnecessary except in unusual cases.
If you know how to determine available memory on a different system,
you can easily add the necessary code.  (And please send it along to
jpeg-info@jpegclub.org so we can include it in future releases!)


INSTALLATION
============

Rename the standard cjpeg.c file to cjpegstd.c, then rename cjpegalt.c to
cjpeg.c.
Rename the standard djpeg.c file to djpegstd.c, then rename djpegalt.c to
djpeg.c.
Then build the software as described in install.txt, with these exceptions:

* Define PROGRESS_REPORT in jconfig.h if you want the percent-done display.
* Define NO_OVERWRITE_CHECK if you *don't* want overwrite confirmation.
* You may ignore the USE_SETMODE and TWO_FILE_COMMANDLINE symbols discussed
  in install.txt; these files do not use them.
* As given, djpegalt.c defaults to BMP output (not PPM output as in the
  standard djpeg.c).  If you want something different, modify DEFAULT_FMT.

You may also need to do something special to enable filename wild-card
expansion, assuming your compiler has that capability at all.

Modify the standard usage.txt file as described below.  (If you want to use
the Unix-style manual pages cjpeg.1 and djpeg.1, better fix them too.)

To restore the standard user interface:
Rename cjpeg.c to cjpegalt.c, then rename cjpegstd.c to cjpeg.c.
Rename djpeg.c to djpegalt.c, then rename djpegstd.c to djpeg.c.
Then recompile/rebuild.


Here are some specific notes for popular MS-DOS compilers:

Borland C:
  Add "-DMSDOS" to CFLAGS to enable use of the DOS memory determination code.
  Link with the standard library file WILDARGS.OBJ to get wild-card expansion.

Microsoft C:
  Add "-DMSDOS" to CFLAGS to enable use of the DOS memory determination code.
  Link with the standard library file SETARGV.OBJ to get wild-card expansion.
  In the versions I've used, you must also add /NOE to the linker switches to
  avoid a duplicate-symbol error from including SETARGV.

DJGPP (we recommend version 2.0 or later):
  Add "-DFREE_MEM_ESTIMATE=0" to CFLAGS.  Wild-card expansion is automatic.


USAGE
=====

Most of the standard usage.txt file also applies to the alternate version,
but replace its "GENERAL USAGE" section with the text below.  Edit the text
as necessary if you don't support wildcards or overwrite checking.  Be sure
to fix the djpeg switch descriptions if you are not defaulting to PPM output.
Also, if you've provided an accurate memory-estimation procedure, you can
probably eliminate the HINTS related to the -maxmemory switch.


GENERAL USAGE

We provide two programs, cjpeg to compress an image file into JPEG format,
and djpeg to decompress a JPEG file back into a conventional image format.

The basic command line is:
	cjpeg [switches] list of image files
or
	djpeg [switches] list of jpeg files

Each file named is compressed or decompressed.  The input file(s) are not
modified; the output data is written to files which have the same names
except for extension.  cjpeg always uses ".jpg" for the output file name's
extension; djpeg uses one of ".bmp", ".gif", ".ppm", ".rle", or ".tga",
depending on what output format is selected by the switches.

For example, to convert xxx.bmp to xxx.jpg and yyy.ppm to yyy.jpg, say:
	cjpeg xxx.bmp yyy.ppm

On most systems you can use standard wildcards to specify the list of input
files; for example, on DOS "djpeg *.jpg" decompresses all the JPEG files in
the current directory.

If an intended output file already exists, you'll be asked whether or not to
overwrite it.  If you say no, the program skips that input file and goes on
to the next one.

You can intermix switches and file names; for example
	djpeg -gif file1.jpg -targa file2.jpg
decompresses file1.jpg into GIF format (file1.gif) and file2.jpg into Targa
format (file2.tga).  Only switches to the left of a given file name affect
processing of that file; when there are conflicting switches, the rightmost
one takes precedence.

You can override the program's choice of output file name by using the
-outfile switch, as in
	cjpeg -outfile output.jpg input.ppm
-outfile only affects the first input file name to its right.

The currently supported image file formats are: PPM (PBMPLUS color format),
PGM (PBMPLUS grayscale format), BMP, GIF, Targa, and RLE (Utah Raster Toolkit
format).  (RLE is supported only if the URT library is available, which it
isn't on most non-Unix systems.)  cjpeg recognizes the input image format
automatically, with the exception of some Targa-format files.  You have to
tell djpeg which format to generate.

JPEG files are in the standard JFIF file format.  There are other,
less widely used JPEG-based file formats, but we don't support them.

All switch names may be abbreviated; for example, -grayscale may be written
-gray or -gr.  Most of the "basic" switches can be abbreviated to as little as
one letter.  Upper and lower case are equivalent (-BMP is the same as -bmp).
British spellings are also accepted (e.g., -greyscale), though for brevity
these are not mentioned below.