/* * jpegtran.c * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1995-2019, Thomas G. Lane, Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright (C) 2010, 2014, 2017, 2019-2022, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. * * This file contains a command-line user interface for JPEG transcoding. * It is very similar to cjpeg.c, and partly to djpeg.c, but provides * lossless transcoding between different JPEG file formats. It also * provides some lossless and sort-of-lossless transformations of JPEG data. */ #ifdef _MSC_VER #define _CRT_SECURE_NO_DEPRECATE #endif #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #include "transupp.h" /* Support routines for jpegtran */ #include "jversion.h" /* for version message */ #include "jconfigint.h" /* * Argument-parsing code. * The switch parser is designed to be useful with DOS-style command line * syntax, ie, intermixed switches and file names, where only the switches * to the left of a given file name affect processing of that file. * The main program in this file doesn't actually use this capability... */ static const char *progname; /* program name for error messages */ static char *icc_filename; /* for -icc switch */ static JDIMENSION max_scans; /* for -maxscans switch */ static char *outfilename; /* for -outfile switch */ static char *dropfilename; /* for -drop switch */ static boolean report; /* for -report switch */ static boolean strict; /* for -strict switch */ static JCOPY_OPTION copyoption; /* -copy switch */ static jpeg_transform_info transformoption; /* image transformation options */ LOCAL(void) usage(void) /* complain about bad command line */ { … } LOCAL(void) select_transform(JXFORM_CODE transform) /* Silly little routine to detect multiple transform options, * which we can't handle. */ { … } LOCAL(int) parse_switches(j_compress_ptr cinfo, int argc, char **argv, int last_file_arg_seen, boolean for_real) /* Parse optional switches. * Returns argv[] index of first file-name argument (== argc if none). * Any file names with indexes <= last_file_arg_seen are ignored; * they have presumably been processed in a previous iteration. * (Pass 0 for last_file_arg_seen on the first or only iteration.) * for_real is FALSE on the first (dummy) pass; we may skip any expensive * processing. */ { … } METHODDEF(void) my_emit_message(j_common_ptr cinfo, int msg_level) { … } /* * The main program. */ int #ifdef GTEST jpegtran(int argc, char **argv) #else main(int argc, char **argv) #endif { … }