ReactOS 0.4.15-dev-7842-g558ab78
jpegtran.c File Reference
#include "cdjpeg.h"
#include "transupp.h"
#include "jversion.h"
Include dependency graph for jpegtran.c:

Go to the source code of this file.

Functions

 usage (void)
 
 select_transform (JXFORM_CODE transform)
 
 parse_switches (j_compress_ptr cinfo, int argc, char **argv, int last_file_arg_seen, boolean for_real)
 
int main (int argc, char **argv)
 

Variables

static const charprogname
 
static charoutfilename
 
static chardropfilename
 
static charscaleoption
 
static JCOPY_OPTION copyoption
 
static jpeg_transform_info transformoption
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 409 of file jpegtran.c.

410{
411 struct jpeg_decompress_struct srcinfo;
412 struct jpeg_error_mgr jsrcerr;
413#if TRANSFORMS_SUPPORTED
414 struct jpeg_decompress_struct dropinfo;
415 struct jpeg_error_mgr jdroperr;
416 FILE * drop_file;
417#endif
419 struct jpeg_error_mgr jdsterr;
420#ifdef PROGRESS_REPORT
422#endif
423 jvirt_barray_ptr * src_coef_arrays;
424 jvirt_barray_ptr * dst_coef_arrays;
425 int file_index;
426 /* We assume all-in-memory processing and can therefore use only a
427 * single file pointer for sequential input and output operation.
428 */
429 FILE * fp;
430
431 /* On Mac, fetch a command line. */
432#ifdef USE_CCOMMAND
433 argc = ccommand(&argv);
434#endif
435
436 progname = argv[0];
437 if (progname == NULL || progname[0] == 0)
438 progname = "jpegtran"; /* in case C library doesn't provide it */
439
440 /* Initialize the JPEG decompression object with default error handling. */
441 srcinfo.err = jpeg_std_error(&jsrcerr);
442 jpeg_create_decompress(&srcinfo);
443 /* Initialize the JPEG compression object with default error handling. */
444 dstinfo.err = jpeg_std_error(&jdsterr);
446
447 /* Now safe to enable signal catcher.
448 * Note: we assume only the decompression object will have virtual arrays.
449 */
450#ifdef NEED_SIGNAL_CATCHER
451 enable_signal_catcher((j_common_ptr) &srcinfo);
452#endif
453
454 /* Scan command line to find file names.
455 * It is convenient to use just one switch-parsing routine, but the switch
456 * values read here are mostly ignored; we will rescan the switches after
457 * opening the input file. Also note that most of the switches affect the
458 * destination JPEG object, so we parse into that and then copy over what
459 * needs to affect the source too.
460 */
461
462 file_index = parse_switches(&dstinfo, argc, argv, 0, FALSE);
463 jsrcerr.trace_level = jdsterr.trace_level;
464 srcinfo.mem->max_memory_to_use = dstinfo.mem->max_memory_to_use;
465
466#ifdef TWO_FILE_COMMANDLINE
467 /* Must have either -outfile switch or explicit output file name */
468 if (outfilename == NULL) {
469 if (file_index != argc-2) {
470 fprintf(stderr, "%s: must name one input and one output file\n",
471 progname);
472 usage();
473 }
474 outfilename = argv[file_index+1];
475 } else {
476 if (file_index != argc-1) {
477 fprintf(stderr, "%s: must name one input and one output file\n",
478 progname);
479 usage();
480 }
481 }
482#else
483 /* Unix style: expect zero or one file name */
484 if (file_index < argc-1) {
485 fprintf(stderr, "%s: only one input file\n", progname);
486 usage();
487 }
488#endif /* TWO_FILE_COMMANDLINE */
489
490 /* Open the input file. */
491 if (file_index < argc) {
492 if ((fp = fopen(argv[file_index], READ_BINARY)) == NULL) {
493 fprintf(stderr, "%s: can't open %s for reading\n", progname, argv[file_index]);
495 }
496 } else {
497 /* default input file is stdin */
498 fp = read_stdin();
499 }
500
501#if TRANSFORMS_SUPPORTED
502 /* Open the drop file. */
503 if (dropfilename != NULL) {
505 fprintf(stderr, "%s: can't open %s for reading\n", progname, dropfilename);
507 }
508 dropinfo.err = jpeg_std_error(&jdroperr);
509 jpeg_create_decompress(&dropinfo);
510 jpeg_stdio_src(&dropinfo, drop_file);
511 } else {
512 drop_file = NULL;
513 }
514#endif
515
516#ifdef PROGRESS_REPORT
517 start_progress_monitor((j_common_ptr) &dstinfo, &progress);
518#endif
519
520 /* Specify data source for decompression */
521 jpeg_stdio_src(&srcinfo, fp);
522
523 /* Enable saving of extra markers that we want to copy */
525
526 /* Read file header */
527 (void) jpeg_read_header(&srcinfo, TRUE);
528
529 /* Adjust default decompression parameters */
530 if (scaleoption != NULL)
531 if (sscanf(scaleoption, "%u/%u",
532 &srcinfo.scale_num, &srcinfo.scale_denom) < 1)
533 usage();
534
535#if TRANSFORMS_SUPPORTED
536 if (dropfilename != NULL) {
537 (void) jpeg_read_header(&dropinfo, TRUE);
538 transformoption.crop_width = dropinfo.image_width;
540 transformoption.crop_height = dropinfo.image_height;
542 transformoption.drop_ptr = &dropinfo;
543 }
544#endif
545
546 /* Any space needed by a transform option must be requested before
547 * jpeg_read_coefficients so that memory allocation will be done right.
548 */
549#if TRANSFORMS_SUPPORTED
550 /* Fail right away if -perfect is given and transformation is not perfect.
551 */
552 if (!jtransform_request_workspace(&srcinfo, &transformoption)) {
553 fprintf(stderr, "%s: transformation is not perfect\n", progname);
555 }
556#endif
557
558 /* Read source file as DCT coefficients */
559 src_coef_arrays = jpeg_read_coefficients(&srcinfo);
560
561#if TRANSFORMS_SUPPORTED
562 if (dropfilename != NULL) {
563 transformoption.drop_coef_arrays = jpeg_read_coefficients(&dropinfo);
564 }
565#endif
566
567 /* Initialize destination compression parameters from source values */
569
570 /* Adjust destination parameters if required by transform options;
571 * also find out which set of coefficient arrays will hold the output.
572 */
573#if TRANSFORMS_SUPPORTED
574 dst_coef_arrays = jtransform_adjust_parameters(&srcinfo, &dstinfo,
575 src_coef_arrays,
577#else
578 dst_coef_arrays = src_coef_arrays;
579#endif
580
581 /* Close input file, if we opened it.
582 * Note: we assume that jpeg_read_coefficients consumed all input
583 * until JPEG_REACHED_EOI, and that jpeg_finish_decompress will
584 * only consume more while (! cinfo->inputctl->eoi_reached).
585 * We cannot call jpeg_finish_decompress here since we still need the
586 * virtual arrays allocated from the source object for processing.
587 */
588 if (fp != stdin)
589 fclose(fp);
590
591 /* Open the output file. */
592 if (outfilename != NULL) {
593 if ((fp = fopen(outfilename, WRITE_BINARY)) == NULL) {
594 fprintf(stderr, "%s: can't open %s for writing\n", progname, outfilename);
596 }
597 } else {
598 /* default output file is stdout */
599 fp = write_stdout();
600 }
601
602 /* Adjust default compression parameters by re-parsing the options */
603 file_index = parse_switches(&dstinfo, argc, argv, 0, TRUE);
604
605 /* Specify data destination for compression */
607
608 /* Start compressor (note no image data is actually written here) */
609 jpeg_write_coefficients(&dstinfo, dst_coef_arrays);
610
611 /* Copy to the output file any extra markers that we want to preserve */
613
614 /* Execute image transformation, if any */
615#if TRANSFORMS_SUPPORTED
616 jtransform_execute_transformation(&srcinfo, &dstinfo,
617 src_coef_arrays,
619#endif
620
621 /* Finish compression and release memory */
624#if TRANSFORMS_SUPPORTED
625 if (dropfilename != NULL) {
626 (void) jpeg_finish_decompress(&dropinfo);
627 jpeg_destroy_decompress(&dropinfo);
628 }
629#endif
630 (void) jpeg_finish_decompress(&srcinfo);
631 jpeg_destroy_decompress(&srcinfo);
632
633 /* Close output file, if we opened it */
634 if (fp != stdout)
635 fclose(fp);
636#if TRANSFORMS_SUPPORTED
637 if (drop_file != NULL)
639#endif
640
641#ifdef PROGRESS_REPORT
642 end_progress_monitor((j_common_ptr) &dstinfo);
643#endif
644
645 /* All done. */
646#if TRANSFORMS_SUPPORTED
647 if (dropfilename != NULL)
648 exit(jsrcerr.num_warnings + jdroperr.num_warnings +
649 jdsterr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
650#endif
651 exit(jsrcerr.num_warnings + jdsterr.num_warnings ?
653 return 0; /* suppress no-return-value warnings */
654}
static int argc
Definition: ServiceArgs.c:12
read_stdin(void)
Definition: cdjpeg.c:149
write_stdout(void)
Definition: cdjpeg.c:167
cd_progress_ptr progress
Definition: cdjpeg.h:152
#define EXIT_WARNING
Definition: cdjpeg.h:187
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static void drop_file(DOS_FS *fs, DOS_FILE *file)
Definition: check.c:388
#define stdout
Definition: stdio.h:99
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
#define stdin
Definition: stdio.h:98
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
jpeg_destroy_compress(j_compress_ptr cinfo)
Definition: jcapimin.c:96
jpeg_finish_compress(j_compress_ptr cinfo)
Definition: jcapimin.c:155
jpeg_copy_critical_parameters(j_decompress_ptr srcinfo, j_compress_ptr dstinfo)
Definition: jctrans.c:64
jpeg_destroy_decompress(j_decompress_ptr cinfo)
Definition: jdapimin.c:92
jpeg_finish_decompress(j_decompress_ptr cinfo)
Definition: jdapimin.c:373
jpeg_read_header(j_decompress_ptr cinfo, boolean require_image)
Definition: jdapimin.c:245
jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile)
Definition: jdatadst.c:195
jpeg_stdio_src(j_decompress_ptr cinfo, FILE *infile)
Definition: jdatasrc.c:212
#define EXIT_FAILURE
Definition: jerror.c:33
jpeg_std_error(struct jpeg_error_mgr *err)
Definition: jerror.c:232
#define READ_BINARY
Definition: jmemdos.c:77
j_compress_ptr dstinfo
Definition: jpeglib.h:1100
#define jpeg_create_decompress(cinfo)
Definition: jpeglib.h:962
#define jpeg_create_compress(cinfo)
Definition: jpeglib.h:959
static JCOPY_OPTION copyoption
Definition: jpegtran.c:42
static char * dropfilename
Definition: jpegtran.c:40
parse_switches(j_compress_ptr cinfo, int argc, char **argv, int last_file_arg_seen, boolean for_real)
Definition: jpegtran.c:124
static char * scaleoption
Definition: jpegtran.c:41
static jpeg_transform_info transformoption
Definition: jpegtran.c:43
static char * outfilename
Definition: jpegtran.c:39
usage(void)
Definition: jpegtran.c:47
static const char * progname
Definition: jpegtran.c:38
#define argv
Definition: mplay32.c:18
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
#define exit(n)
Definition: config.h:202
JDIMENSION crop_height
Definition: transupp.h:151
JCROP_CODE crop_height_set
Definition: transupp.h:152
j_decompress_ptr drop_ptr
Definition: transupp.h:159
JCROP_CODE crop_width_set
Definition: transupp.h:150
JDIMENSION crop_width
Definition: transupp.h:149
jvirt_barray_ptr * drop_coef_arrays
Definition: transupp.h:160
jcopy_markers_setup(j_decompress_ptr srcinfo, JCOPY_OPTION option)
Definition: transupp.c:2367
jcopy_markers_execute(j_decompress_ptr srcinfo, j_compress_ptr dstinfo, JCOPY_OPTION option)
Definition: transupp.c:2392
@ JCROP_POS
Definition: transupp.h:126
#define WRITE_BINARY
Definition: wrjpgcom.c:47

◆ parse_switches()

parse_switches ( j_compress_ptr  cinfo,
int  argc,
char **  argv,
int  last_file_arg_seen,
boolean  for_real 
)

Definition at line 124 of file jpegtran.c.

134{
135 int argn;
136 char * arg;
137 boolean simple_progressive;
138 char * scansarg = NULL; /* saves -scans parm if any */
139
140 /* Set up default JPEG parameters. */
141 simple_progressive = FALSE;
150 cinfo->err->trace_level = 0;
151
152 /* Scan command line options, adjust parameters */
153
154 for (argn = 1; argn < argc; argn++) {
155 arg = argv[argn];
156 if (*arg != '-') {
157 /* Not a switch, must be a file name argument */
158 if (argn <= last_file_arg_seen) {
159 outfilename = NULL; /* -outfile applies to just one input file */
160 continue; /* ignore this name if previously processed */
161 }
162 break; /* else done parsing switches */
163 }
164 arg++; /* advance past switch marker character */
165
166 if (keymatch(arg, "arithmetic", 1)) {
167 /* Use arithmetic coding. */
168#ifdef C_ARITH_CODING_SUPPORTED
169 cinfo->arith_code = TRUE;
170#else
171 fprintf(stderr, "%s: sorry, arithmetic coding not supported\n",
172 progname);
174#endif
175
176 } else if (keymatch(arg, "copy", 2)) {
177 /* Select which extra markers to copy. */
178 if (++argn >= argc) /* advance to next argument */
179 usage();
180 if (keymatch(argv[argn], "none", 1)) {
182 } else if (keymatch(argv[argn], "comments", 1)) {
184 } else if (keymatch(argv[argn], "all", 1)) {
186 } else
187 usage();
188
189 } else if (keymatch(arg, "crop", 2)) {
190 /* Perform lossless cropping. */
191#if TRANSFORMS_SUPPORTED
192 if (++argn >= argc) /* advance to next argument */
193 usage();
194 if (transformoption.crop /* reject multiple crop/drop/wipe requests */ ||
195 ! jtransform_parse_crop_spec(&transformoption, argv[argn])) {
196 fprintf(stderr, "%s: bogus -crop argument '%s'\n",
197 progname, argv[argn]);
199 }
200#else
201 select_transform(JXFORM_NONE); /* force an error */
202#endif
203
204 } else if (keymatch(arg, "drop", 2)) {
205#if TRANSFORMS_SUPPORTED
206 if (++argn >= argc) /* advance to next argument */
207 usage();
208 if (transformoption.crop /* reject multiple crop/drop/wipe requests */ ||
209 ! jtransform_parse_crop_spec(&transformoption, argv[argn]) ||
212 fprintf(stderr, "%s: bogus -drop argument '%s'\n",
213 progname, argv[argn]);
215 }
216 if (++argn >= argc) /* advance to next argument */
217 usage();
218 dropfilename = argv[argn];
220#else
221 select_transform(JXFORM_NONE); /* force an error */
222#endif
223
224 } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
225 /* Enable debug printouts. */
226 /* On first -d, print version identification */
227 static boolean printed_version = FALSE;
228
229 if (! printed_version) {
230 fprintf(stderr, "Independent JPEG Group's JPEGTRAN, version %s\n%s\n",
232 printed_version = TRUE;
233 }
234 cinfo->err->trace_level++;
235
236 } else if (keymatch(arg, "flip", 1)) {
237 /* Mirror left-right or top-bottom. */
238 if (++argn >= argc) /* advance to next argument */
239 usage();
240 if (keymatch(argv[argn], "horizontal", 1))
242 else if (keymatch(argv[argn], "vertical", 1))
244 else
245 usage();
246
247 } else if (keymatch(arg, "grayscale", 1) || keymatch(arg, "greyscale",1)) {
248 /* Force to grayscale. */
249#if TRANSFORMS_SUPPORTED
251#else
252 select_transform(JXFORM_NONE); /* force an error */
253#endif
254
255 } else if (keymatch(arg, "maxmemory", 3)) {
256 /* Maximum memory in Kb (or Mb with 'm'). */
257 long lval;
258 char ch = 'x';
259
260 if (++argn >= argc) /* advance to next argument */
261 usage();
262 if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
263 usage();
264 if (ch == 'm' || ch == 'M')
265 lval *= 1000L;
266 cinfo->mem->max_memory_to_use = lval * 1000L;
267
268 } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
269 /* Enable entropy parm optimization. */
270#ifdef ENTROPY_OPT_SUPPORTED
271 cinfo->optimize_coding = TRUE;
272#else
273 fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n",
274 progname);
276#endif
277
278 } else if (keymatch(arg, "outfile", 4)) {
279 /* Set output file name. */
280 if (++argn >= argc) /* advance to next argument */
281 usage();
282 outfilename = argv[argn]; /* save it away for later use */
283
284 } else if (keymatch(arg, "perfect", 2)) {
285 /* Fail if there is any partial edge MCUs that the transform can't
286 * handle. */
288
289 } else if (keymatch(arg, "progressive", 2)) {
290 /* Select simple progressive mode. */
291#ifdef C_PROGRESSIVE_SUPPORTED
292 simple_progressive = TRUE;
293 /* We must postpone execution until num_components is known. */
294#else
295 fprintf(stderr, "%s: sorry, progressive output was not compiled\n",
296 progname);
298#endif
299
300 } else if (keymatch(arg, "restart", 1)) {
301 /* Restart interval in MCU rows (or in MCUs with 'b'). */
302 long lval;
303 char ch = 'x';
304
305 if (++argn >= argc) /* advance to next argument */
306 usage();
307 if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
308 usage();
309 if (lval < 0 || lval > 65535L)
310 usage();
311 if (ch == 'b' || ch == 'B') {
312 cinfo->restart_interval = (unsigned int) lval;
313 cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
314 } else {
315 cinfo->restart_in_rows = (int) lval;
316 /* restart_interval will be computed during startup */
317 }
318
319 } else if (keymatch(arg, "rotate", 2)) {
320 /* Rotate 90, 180, or 270 degrees (measured clockwise). */
321 if (++argn >= argc) /* advance to next argument */
322 usage();
323 if (keymatch(argv[argn], "90", 2))
325 else if (keymatch(argv[argn], "180", 3))
327 else if (keymatch(argv[argn], "270", 3))
329 else
330 usage();
331
332 } else if (keymatch(arg, "scale", 4)) {
333 /* Scale the output image by a fraction M/N. */
334 if (++argn >= argc) /* advance to next argument */
335 usage();
336 scaleoption = argv[argn];
337 /* We must postpone processing until decompression startup. */
338
339 } else if (keymatch(arg, "scans", 1)) {
340 /* Set scan script. */
341#ifdef C_MULTISCAN_FILES_SUPPORTED
342 if (++argn >= argc) /* advance to next argument */
343 usage();
344 scansarg = argv[argn];
345 /* We must postpone reading the file in case -progressive appears. */
346#else
347 fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n",
348 progname);
350#endif
351
352 } else if (keymatch(arg, "transpose", 1)) {
353 /* Transpose (across UL-to-LR axis). */
355
356 } else if (keymatch(arg, "transverse", 6)) {
357 /* Transverse transpose (across UR-to-LL axis). */
359
360 } else if (keymatch(arg, "trim", 3)) {
361 /* Trim off any partial edge MCUs that the transform can't handle. */
363
364 } else if (keymatch(arg, "wipe", 1)) {
365#if TRANSFORMS_SUPPORTED
366 if (++argn >= argc) /* advance to next argument */
367 usage();
368 if (transformoption.crop /* reject multiple crop/drop/wipe requests */ ||
369 ! jtransform_parse_crop_spec(&transformoption, argv[argn])) {
370 fprintf(stderr, "%s: bogus -wipe argument '%s'\n",
371 progname, argv[argn]);
373 }
375#else
376 select_transform(JXFORM_NONE); /* force an error */
377#endif
378
379 } else {
380 usage(); /* bogus switch */
381 }
382 }
383
384 /* Post-switch-scanning cleanup */
385
386 if (for_real) {
387
388#ifdef C_PROGRESSIVE_SUPPORTED
389 if (simple_progressive) /* process -progressive; -scans can override */
390 jpeg_simple_progression(cinfo);
391#endif
392
393#ifdef C_MULTISCAN_FILES_SUPPORTED
394 if (scansarg != NULL) /* process -scans if it was present */
395 if (! read_scan_script(cinfo, scansarg))
396 usage();
397#endif
398 }
399
400 return argn; /* return index of next arg (file name) */
401}
keymatch(char *arg, const char *keyword, int minchars)
Definition: cdjpeg.c:122
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
select_transform(JXFORM_CODE transform)
Definition: jpegtran.c:101
#define JVERSION
Definition: jversion.h:12
#define JCOPYRIGHT
Definition: jversion.h:14
boolean optimize_coding
Definition: jpeglib.h:359
unsigned int restart_interval
Definition: jpeglib.h:370
boolean arith_code
Definition: jpeglib.h:358
boolean force_grayscale
Definition: transupp.h:143
JXFORM_CODE transform
Definition: transupp.h:140
@ JXFORM_DROP
Definition: transupp.h:115
@ JXFORM_FLIP_H
Definition: transupp.h:107
@ JXFORM_ROT_270
Definition: transupp.h:113
@ JXFORM_TRANSPOSE
Definition: transupp.h:109
@ JXFORM_TRANSVERSE
Definition: transupp.h:110
@ JXFORM_NONE
Definition: transupp.h:106
@ JXFORM_WIPE
Definition: transupp.h:114
@ JXFORM_ROT_180
Definition: transupp.h:112
@ JXFORM_FLIP_V
Definition: transupp.h:108
@ JXFORM_ROT_90
Definition: transupp.h:111
@ JCOPYOPT_NONE
Definition: transupp.h:217
@ JCOPYOPT_COMMENTS
Definition: transupp.h:218
@ JCOPYOPT_ALL
Definition: transupp.h:219
@ JCROP_UNSET
Definition: transupp.h:125
#define JCOPYOPT_DEFAULT
Definition: transupp.h:222
void * arg
Definition: msvc.h:10

Referenced by main().

◆ select_transform()

select_transform ( JXFORM_CODE  transform)

Definition at line 101 of file jpegtran.c.

105{
106#if TRANSFORMS_SUPPORTED
110 } else {
111 fprintf(stderr, "%s: can only do one image transformation at a time\n",
112 progname);
113 usage();
114 }
115#else
116 fprintf(stderr, "%s: sorry, image transformation was not compiled\n",
117 progname);
119#endif
120}
GLuint GLenum GLenum transform
Definition: glext.h:9407

Referenced by parse_switches().

◆ usage()

usage ( void  )

Definition at line 47 of file jpegtran.c.

49{
50 fprintf(stderr, "usage: %s [switches] ", progname);
51#ifdef TWO_FILE_COMMANDLINE
52 fprintf(stderr, "inputfile outputfile\n");
53#else
54 fprintf(stderr, "[inputfile]\n");
55#endif
56
57 fprintf(stderr, "Switches (names may be abbreviated):\n");
58 fprintf(stderr, " -copy none Copy no extra markers from source file\n");
59 fprintf(stderr, " -copy comments Copy only comment markers (default)\n");
60 fprintf(stderr, " -copy all Copy all extra markers\n");
61#ifdef ENTROPY_OPT_SUPPORTED
62 fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n");
63#endif
64#ifdef C_PROGRESSIVE_SUPPORTED
65 fprintf(stderr, " -progressive Create progressive JPEG file\n");
66#endif
67 fprintf(stderr, "Switches for modifying the image:\n");
68#if TRANSFORMS_SUPPORTED
69 fprintf(stderr, " -crop WxH+X+Y Crop to a rectangular subarea\n");
70 fprintf(stderr, " -drop +X+Y filename Drop another image\n");
71 fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n");
72 fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n");
73 fprintf(stderr, " -perfect Fail if there is non-transformable edge blocks\n");
74 fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n");
75#endif
76 fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n");
77#if TRANSFORMS_SUPPORTED
78 fprintf(stderr, " -transpose Transpose image\n");
79 fprintf(stderr, " -transverse Transverse transpose image\n");
80 fprintf(stderr, " -trim Drop non-transformable edge blocks\n");
81 fprintf(stderr, " with -drop: Requantize drop file to source file\n");
82 fprintf(stderr, " -wipe WxH+X+Y Wipe (gray out) a rectangular subarea\n");
83#endif
84 fprintf(stderr, "Switches for advanced users:\n");
85#ifdef C_ARITH_CODING_SUPPORTED
86 fprintf(stderr, " -arithmetic Use arithmetic coding\n");
87#endif
88 fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
89 fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n");
90 fprintf(stderr, " -outfile name Specify name for output file\n");
91 fprintf(stderr, " -verbose or -debug Emit debug output\n");
92 fprintf(stderr, "Switches for wizards:\n");
93#ifdef C_MULTISCAN_FILES_SUPPORTED
94 fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n");
95#endif
97}

Referenced by main(), parse_switches(), and select_transform().

Variable Documentation

◆ copyoption

JCOPY_OPTION copyoption
static

Definition at line 42 of file jpegtran.c.

Referenced by main(), and parse_switches().

◆ dropfilename

char* dropfilename
static

Definition at line 40 of file jpegtran.c.

Referenced by main(), and parse_switches().

◆ outfilename

char* outfilename
static

Definition at line 39 of file jpegtran.c.

Referenced by main(), and parse_switches().

◆ progname

const char* progname
static

Definition at line 38 of file jpegtran.c.

Referenced by main(), parse_switches(), select_transform(), and usage().

◆ scaleoption

char* scaleoption
static

Definition at line 41 of file jpegtran.c.

Referenced by main(), and parse_switches().

◆ transformoption

jpeg_transform_info transformoption
static

Definition at line 43 of file jpegtran.c.

Referenced by main(), parse_switches(), and select_transform().