51#ifdef TWO_FILE_COMMANDLINE
58 fprintf(
stderr,
" -copy none Copy no extra markers from source file\n");
59 fprintf(
stderr,
" -copy comments Copy only comment markers (default)\n");
61#ifdef ENTROPY_OPT_SUPPORTED
62 fprintf(
stderr,
" -optimize Optimize Huffman table (smaller file, but slow compression)\n");
64#ifdef C_PROGRESSIVE_SUPPORTED
65 fprintf(
stderr,
" -progressive Create progressive JPEG file\n");
68#if TRANSFORMS_SUPPORTED
69 fprintf(
stderr,
" -crop WxH+X+Y Crop to a rectangular subarea\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");
76 fprintf(
stderr,
" -scale M/N Scale output image by fraction M/N, eg, 1/8\n");
77#if TRANSFORMS_SUPPORTED
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");
85#ifdef C_ARITH_CODING_SUPPORTED
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");
93#ifdef C_MULTISCAN_FILES_SUPPORTED
94 fprintf(
stderr,
" -scans file Create multi-scan JPEG per script file\n");
106#if TRANSFORMS_SUPPORTED
111 fprintf(
stderr,
"%s: can only do one image transformation at a time\n",
116 fprintf(
stderr,
"%s: sorry, image transformation was not compiled\n",
125 int last_file_arg_seen,
boolean for_real)
137 boolean simple_progressive;
138 char * scansarg =
NULL;
141 simple_progressive =
FALSE;
150 cinfo->err->trace_level = 0;
154 for (argn = 1; argn <
argc; argn++) {
158 if (argn <= last_file_arg_seen) {
168#ifdef C_ARITH_CODING_SUPPORTED
169 cinfo->arith_code =
TRUE;
171 fprintf(
stderr,
"%s: sorry, arithmetic coding not supported\n",
191#if TRANSFORMS_SUPPORTED
205#if TRANSFORMS_SUPPORTED
227 static boolean printed_version =
FALSE;
229 if (! printed_version) {
230 fprintf(
stderr,
"Independent JPEG Group's JPEGTRAN, version %s\n%s\n",
232 printed_version =
TRUE;
234 cinfo->err->trace_level++;
249#if TRANSFORMS_SUPPORTED
262 if (
sscanf(
argv[argn],
"%ld%c", &lval, &ch) < 1)
264 if (ch ==
'm' || ch ==
'M')
266 cinfo->mem->max_memory_to_use = lval * 1000L;
270#ifdef ENTROPY_OPT_SUPPORTED
271 cinfo->optimize_coding =
TRUE;
273 fprintf(
stderr,
"%s: sorry, entropy optimization was not compiled\n",
291#ifdef C_PROGRESSIVE_SUPPORTED
292 simple_progressive =
TRUE;
295 fprintf(
stderr,
"%s: sorry, progressive output was not compiled\n",
307 if (
sscanf(
argv[argn],
"%ld%c", &lval, &ch) < 1)
309 if (lval < 0 || lval > 65535L)
311 if (ch ==
'b' || ch ==
'B') {
312 cinfo->restart_interval = (
unsigned int) lval;
313 cinfo->restart_in_rows = 0;
315 cinfo->restart_in_rows = (
int) lval;
341#ifdef C_MULTISCAN_FILES_SUPPORTED
344 scansarg =
argv[argn];
347 fprintf(
stderr,
"%s: sorry, multi-scan output was not compiled\n",
365#if TRANSFORMS_SUPPORTED
388#ifdef C_PROGRESSIVE_SUPPORTED
389 if (simple_progressive)
390 jpeg_simple_progression(cinfo);
393#ifdef C_MULTISCAN_FILES_SUPPORTED
394 if (scansarg !=
NULL)
395 if (! read_scan_script(cinfo, scansarg))
413#if TRANSFORMS_SUPPORTED
420#ifdef PROGRESS_REPORT
450#ifdef NEED_SIGNAL_CATCHER
464 srcinfo.mem->max_memory_to_use =
dstinfo.mem->max_memory_to_use;
466#ifdef TWO_FILE_COMMANDLINE
469 if (file_index !=
argc-2) {
470 fprintf(
stderr,
"%s: must name one input and one output file\n",
476 if (file_index !=
argc-1) {
477 fprintf(
stderr,
"%s: must name one input and one output file\n",
484 if (file_index <
argc-1) {
491 if (file_index <
argc) {
501#if TRANSFORMS_SUPPORTED
516#ifdef PROGRESS_REPORT
535#if TRANSFORMS_SUPPORTED
549#if TRANSFORMS_SUPPORTED
559 src_coef_arrays = jpeg_read_coefficients(&srcinfo);
561#if TRANSFORMS_SUPPORTED
573#if TRANSFORMS_SUPPORTED
574 dst_coef_arrays = jtransform_adjust_parameters(&srcinfo, &
dstinfo,
578 dst_coef_arrays = src_coef_arrays;
609 jpeg_write_coefficients(&
dstinfo, dst_coef_arrays);
615#if TRANSFORMS_SUPPORTED
616 jtransform_execute_transformation(&srcinfo, &
dstinfo,
624#if TRANSFORMS_SUPPORTED
636#if TRANSFORMS_SUPPORTED
641#ifdef PROGRESS_REPORT
646#if TRANSFORMS_SUPPORTED
keymatch(char *arg, const char *keyword, int minchars)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
static void drop_file(DOS_FS *fs, DOS_FILE *file)
GLuint GLenum GLenum transform
GLsizeiptr const GLvoid GLenum usage
_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)
_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)
jpeg_finish_compress(j_compress_ptr cinfo)
jpeg_copy_critical_parameters(j_decompress_ptr srcinfo, j_compress_ptr dstinfo)
jpeg_destroy_decompress(j_decompress_ptr cinfo)
jpeg_finish_decompress(j_decompress_ptr cinfo)
jpeg_read_header(j_decompress_ptr cinfo, boolean require_image)
jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile)
jpeg_stdio_src(j_decompress_ptr cinfo, FILE *infile)
jpeg_std_error(struct jpeg_error_mgr *err)
#define jpeg_create_decompress(cinfo)
#define jpeg_create_compress(cinfo)
static JCOPY_OPTION copyoption
static char * dropfilename
parse_switches(j_compress_ptr cinfo, int argc, char **argv, int last_file_arg_seen, boolean for_real)
static char * scaleoption
static jpeg_transform_info transformoption
static char * outfilename
static const char * progname
select_transform(JXFORM_CODE transform)
jcopy_markers_setup(j_decompress_ptr srcinfo, JCOPY_OPTION option)
jcopy_markers_execute(j_decompress_ptr srcinfo, j_compress_ptr dstinfo, JCOPY_OPTION option)