From: DRC Date: Thu, 18 Feb 2016 21:16:17 +0000 (-0600) Subject: Include some comments/doc tweaks from jpeg-9+ X-Git-Tag: 1.4.90~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=54e6b8e806a4a1f6be2a69d2395e49d91c906a1e;p=libjpeg-turbo Include some comments/doc tweaks from jpeg-9+ --- 54e6b8e806a4a1f6be2a69d2395e49d91c906a1e diff --cc README.ijg index 3a00763,4c8e82e..9c450ce --- a/README.ijg +++ b/README.ijg @@@ -166,17 -153,12 +166,17 @@@ ltmain.sh). Another support script, in but is also freely distributable. The IJG distribution formerly included code to read and write GIF files. - To avoid entanglement with the Unisys LZW patent, GIF reading support has - been removed altogether, and the GIF writer has been simplified to produce - "uncompressed GIFs". This technique does not use the LZW algorithm; the - resulting GIF files are larger than usual, but are readable by all standard - GIF decoders. + To avoid entanglement with the Unisys LZW patent (now expired), GIF reading + support has been removed altogether, and the GIF writer has been simplified + to produce "uncompressed GIFs". This technique does not use the LZW + algorithm; the resulting GIF files are larger than usual, but are readable + by all standard GIF decoders. +We are required to state that + "The Graphics Interchange Format(c) is the Copyright property of + CompuServe Incorporated. GIF(sm) is a Service Mark property of + CompuServe Incorporated." + REFERENCES ========== @@@ -246,9 -245,9 +246,7 @@@ ARCHIVE LOCATION The "official" archive site for this software is www.ijg.org. The most recent released version can always be found there in --directory "files". This particular version will be archived as - http://www.ijg.org/files/jpegsrc.v8d.tar.gz, and in Windows-compatible - "zip" archive format as http://www.ijg.org/files/jpegsr8d.zip. -http://www.ijg.org/files/jpegsrc.v9b.tar.gz, and in Windows-compatible -"zip" archive format as http://www.ijg.org/files/jpegsr9b.zip. ++directory "files". The JPEG FAQ (Frequently Asked Questions) article is a source of some general information about JPEG. diff --cc change.log index b60ddd6,b8439f4..563648a --- a/change.log +++ b/change.log @@@ -4,6 -1,92 +4,23 @@@ information relevant to libjpeg-turbo CHANGE LOG for Independent JPEG Group's JPEG software + Version 9b 17-Jan-2016 + ----------------------- + -Improvements and optimizations in DCT and color calculations. -Normalize range limit array composition and access pattern. -Thank to Sia Furler and Maddie Ziegler for inspiration. - -Use merged upsample with scaled DCT sizes larger than 8. -Thank to Taylor Hatala for inspiration. - -Check for excessive comment lengths in argument parsing in wrjpgcom.c. -Thank to Julian Cohen for hint. - -Add makefile.b32 for use with Borland C++ 32-bit (bcc32). -Thank to Joe Slater for contribution. - + Document 'f' specifier for jpegtran -crop specification. + Thank to Michele Martone for suggestion. + -Use defined value from header instead of hardwired number in rdswitch.c. -Thank to Robert Sprowson for hint. - - -Version 9a 19-Jan-2014 ------------------------ - -Add support for wide gamut color spaces (JFIF version 2). -Improve clarity and accuracy in color conversion modules. -Note: Requires rebuild of test images. - -Extend the bit depth support to all values from 8 to 12 -(BITS_IN_JSAMPLE configuration option in jmorecfg.h). -jpegtran now supports N bits sample data precision with all N from 8 to 12 -in a single instance. Thank to Roland Fassauer for inspiration. - -Try to resolve issues with new boolean type definition. -Thank also to v4hn for suggestion. - -Enable option to use default Huffman tables for lossless compression -(for hardware solution), and in this case improve lossless RGB compression -with reversible color transform. Thank to Benny Alexandar for hint. - -Extend the entropy decoding structure, so that extraneous bytes between -compressed scan data and following marker can be reported correctly. -Thank to Nigel Tao for hint. - -Add jpegtran -wipe option and extension for -crop. -Thank to Andrew Senior, David Clunie, and Josef Schmid for suggestion. - + + Version 9 13-Jan-2013 + ---------------------- + -Add cjpeg -rgb1 option to create an RGB JPEG file, and insert -a simple reversible color transform into the processing which -significantly improves the compression. -The recommended command for lossless coding of RGB images is now -cjpeg -rgb1 -block 1 -arithmetic. -As said, this option improves the compression significantly, but -the files are not compatible with JPEG decoders prior to IJG v9 -due to the included color transform. -The used color transform and marker signaling is compatible with -other JPEG standards (e.g., JPEG-LS part 2). - -Remove the automatic de-ANSI-fication support (Automake 1.12). -Thank also to Nitin A Kamble for suggestion. - + Add remark for jpeg_mem_dest() in jdatadst.c. + Thank to Elie-Gregoire Khoury for the hint. + -Support files with invalid component identifiers (created -by Adobe PDF). Thank to Robin Watts for the suggestion. - -Adapt full buffer case in jcmainct.c for use with scaled DCT. -Thank to Sergii Biloshytskyi for the suggestion. - -Add type identifier for declaration of noreturn functions. -Thank to Brett L. Moore for the suggestion. - + Correct argument type in format string, avoid compiler warnings. + Thank to Vincent Torri for hint. + -Add missing #include directives in configuration checks, avoid -configuration errors. Thank to John Spencer for the hint. - + Version 8d 15-Jan-2012 ----------------------- diff --cc djpeg.c index 93567c6,0c9b89b..80f620f --- a/djpeg.c +++ b/djpeg.c @@@ -1,13 -1,10 +1,14 @@@ /* * djpeg.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. - * Modified 2009-2015 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. ++ * Modified 2013 by Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2010-2011, 2013-2015, D. R. Commander. + * Copyright (C) 2015, Google, Inc. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains a command-line user interface for the JPEG decompressor. * It should work on any system with Unix- or MS-DOS-style command lines. @@@ -369,28 -328,13 +370,28 @@@ parse_switches (j_decompress_ptr cinfo /* RLE output format. */ requested_fmt = FMT_RLE; - } else if (keymatch(arg, "scale", 1)) { + } else if (keymatch(arg, "scale", 2)) { /* Scale the output image by a fraction M/N. */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); - if (sscanf(argv[argn], "%d/%d", + if (sscanf(argv[argn], "%u/%u", - &cinfo->scale_num, &cinfo->scale_denom) < 1) - usage(); + &cinfo->scale_num, &cinfo->scale_denom) != 2) + usage(); + + } else if (keymatch(arg, "strip", 2)) { + if (++argn >= argc) + usage(); + if (sscanf(argv[argn], "%d,%d", &startY, &endY) != 2 || startY > endY) + usage(); + strip = TRUE; + + + } else if (keymatch(arg, "skip", 2)) { + if (++argn >= argc) + usage(); + if (sscanf(argv[argn], "%d,%d", &startY, &endY) != 2 || startY > endY) + usage(); + skip = TRUE; } else if (keymatch(arg, "targa", 1)) { /* Targa output format. */ diff --cc jdarith.c index a9a6ec6,5533c07..83a05c6 --- a/jdarith.c +++ b/jdarith.c @@@ -1,12 -1,9 +1,12 @@@ /* * jdarith.c * + * This file was part of the Independent JPEG Group's software: - * Developed 1997-2009 by Guido Vollbeding. + * Developed 1997-2015 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. + * libjpeg-turbo Modifications: + * Copyright (C) 2015, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains portable arithmetic entropy decoding routines for JPEG * (implementing the ISO/IEC IS 10918-1 and CCITT Recommendation ITU-T T.81). diff --cc jpegtran.1 index 5b8e126,caefcd1..7f3c853 --- a/jpegtran.1 +++ b/jpegtran.1 @@@ -1,4 -1,4 +1,4 @@@ - .TH JPEGTRAN 1 "21 November 2014" -.TH JPEGTRAN 1 "20 September 2015" ++.TH JPEGTRAN 1 "18 February 2016" .SH NAME jpegtran \- lossless transformation of JPEG files .SH SYNOPSIS @@@ -149,16 -157,30 +157,28 @@@ For example, you may want to d .I foo.jpg .B | pnmflip \-r90 | cjpeg) .IP -to do a perfect rotation if available or an approximated one if not. +to do a perfect rotation, if available, or an approximated one if not. + .PP -We also offer a lossless-crop option, which discards data outside a given -image region but losslessly preserves what is inside. Like the rotate and -flip transforms, lossless crop is restricted by the current JPEG format: the -upper left corner of the selected region must fall on an iMCU boundary. If -this does not hold for the given crop parameters, we silently move the upper -left corner up and/or left to make it so, simultaneously increasing the -region dimensions to keep the lower right crop corner unchanged. (Thus, the -output image covers at least the requested region, but may cover more.) -The adjustment of the region dimensions may be optionally disabled by -attaching an 'f' character ("force") to the width or height number. ++This version of \fBjpegtran\fR also offers a lossless crop option, which ++discards data outside of a given image region but losslessly preserves what is ++inside. Like the rotate and flip transforms, lossless crop is restricted by the ++current JPEG format; the upper left corner of the selected region must fall on ++an iMCU boundary. If it doesn't, then it is silently moved up and/or left to ++the nearest iMCU boundary (the lower right corner is unchanged.) Thus, the ++output image covers at least the requested region, but it may cover more. The ++adjustment of the region dimensions may be optionally disabled by attaching ++an 'f' character ("force") to the width or height number. + + The image can be losslessly cropped by giving the switch: .TP .B \-crop WxH+X+Y -Crop to a rectangular subarea of width W, height H starting at point X,Y. -.PP -A complementary lossless-wipe option is provided to discard (gray out) data -inside a given image region while losslessly preserving what is outside: -.TP -.B \-wipe WxH+X+Y -Wipe (gray out) a rectangular subarea of width W, height H starting at point -X,Y. +Crop the image to a rectangular region of width W and height H, starting at +point X,Y. The lossless crop feature discards data outside of a given image +region but losslessly preserves what is inside. Like the rotate and flip +transforms, lossless crop is restricted by the current JPEG format; the upper +left corner of the selected region must fall on an iMCU boundary. If it +doesn't, then it is silently moved up and/or left to the nearest iMCU boundary +(the lower right corner is unchanged.) .PP Other not-strictly-lossless transformation switches are: .TP @@@ -180,19 -215,24 +200,20 @@@ such as comment blocks .TP .B \-copy none Copy no extra markers from source file. This setting suppresses all - comments and other excess baggage present in the source file. + comments and other metadata in the source file. .TP .B \-copy comments -Copy only comment markers. This setting copies comments from the source file, +Copy only comment markers. This setting copies comments from the source file - but discards any other data that is inessential for image display. + but discards any other metadata. .TP .B \-copy all -Copy all extra markers. This setting preserves metadata +Copy all extra markers. This setting preserves miscellaneous markers found in the source file, such as JFIF thumbnails, Exif data, and Photoshop - settings. In some files, these extra markers can be sizable. -settings. In some files these extra markers can be sizable. Note that this ++settings. In some files, these extra markers can be sizable. Note that this + option will copy thumbnails as-is; they will not be transformed. -.IP -The default behavior is -.BR "\-copy comments" . -(Note: in IJG releases v6 and v6a, -.B jpegtran -always did the equivalent of -.BR "\-copy none" .) +.PP +The default behavior is \fB-copy comments\fR. (Note: in IJG releases v6 and +v6a, \fBjpegtran\fR always did the equivalent of \fB-copy none\fR.) .PP Additional switches recognized by jpegtran are: .TP diff --cc jversion.h index dfea378,0740b31..d05a959 --- a/jversion.h +++ b/jversion.h @@@ -12,27 -9,6 +12,27 @@@ */ -#define JVERSION "9b 17-Jan-2016" +#if JPEG_LIB_VERSION >= 80 -#define JCOPYRIGHT "Copyright (C) 2016, Thomas G. Lane, Guido Vollbeding" +#define JVERSION "8d 15-Jan-2012" + +#elif JPEG_LIB_VERSION >= 70 + +#define JVERSION "7 27-Jun-2009" + +#else + +#define JVERSION "6b 27-Mar-1998" + +#endif + - #define JCOPYRIGHT "Copyright (C) 1991-2012 Thomas G. Lane, Guido Vollbeding\n" \ ++#define JCOPYRIGHT "Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding\n" \ + "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ + "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \ + "Copyright (C) 2009-2016 D. R. Commander\n" \ + "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ + "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ + "Copyright (C) 2013 Linaro Limited\n" \ + "Copyright (C) 2015 Matthieu Darbois" + +#define JCOPYRIGHT_SHORT "Copyright (C) 1991-2016 The libjpeg-turbo Project and many others" diff --cc libjpeg.txt index d1f6417,4243c24..58f11b3 --- a/libjpeg.txt +++ b/libjpeg.txt @@@ -1,11 -1,8 +1,11 @@@ USING THE IJG JPEG LIBRARY +This file was part of the Independent JPEG Group's software: - Copyright (C) 1994-2011, Thomas G. Lane, Guido Vollbeding. + Copyright (C) 1994-2013, Thomas G. Lane, Guido Vollbeding. -This file is part of the Independent JPEG Group's software. -For conditions of distribution and use, see the accompanying README file. +libjpeg-turbo Modifications: +Copyright (C) 2010, 2014, 2015, D. R. Commander. +Copyright (C) 2015, Google, Inc. +For conditions of distribution and use, see the accompanying README.ijg file. This file describes how to use the IJG JPEG library within an application @@@ -916,32 -876,45 +916,36 @@@ jpeg_simple_progression (j_compress_pt Compression parameters (cinfo fields) include: + boolean arith_code + If TRUE, use arithmetic coding. + If FALSE, use Huffman coding. + -int block_size - Set DCT block size. All N from 1 to 16 are possible. - Default is 8 (baseline format). - Larger values produce higher compression, - smaller values produce higher quality. - An exact DCT stage is possible with 1 or 2. - With the default quality of 75 and default Luminance qtable - the DCT+Quantization stage is lossless for value 1. - Note that values other than 8 require a SmartScale capable decoder, - introduced with IJG JPEG 8. Setting the block_size parameter for - compression works with version 8c and later. - J_DCT_METHOD dct_method - Selects the algorithm used for the DCT step. Choices are: - JDCT_ISLOW: slow but accurate integer algorithm - JDCT_IFAST: faster, less accurate integer method - JDCT_FLOAT: floating-point method - JDCT_DEFAULT: default method (normally JDCT_ISLOW) - JDCT_FASTEST: fastest method (normally JDCT_IFAST) - The FLOAT method is very slightly more accurate than the ISLOW method, - but may give different results on different machines due to varying - roundoff behavior. The integer methods should give the same results - on all machines. On machines with sufficiently fast FP hardware, the - floating-point method may also be the fastest. The IFAST method is - considerably less accurate than the other two; its use is not - recommended if high quality is a concern. JDCT_DEFAULT and - JDCT_FASTEST are macros configurable by each installation. - -unsigned int scale_num, scale_denom - Scale the image by the fraction scale_num/scale_denom. Default is - 1/1, or no scaling. Currently, the supported scaling ratios are - M/N with all N from 1 to 16, where M is the destination DCT size, - which is 8 by default (see block_size parameter above). - (The library design allows for arbitrary scaling ratios but this - is not likely to be implemented any time soon.) + Selects the algorithm used for the DCT step. Choices are: + JDCT_ISLOW: slow but accurate integer algorithm + JDCT_IFAST: faster, less accurate integer method + JDCT_FLOAT: floating-point method + JDCT_DEFAULT: default method (normally JDCT_ISLOW) + JDCT_FASTEST: fastest method (normally JDCT_IFAST) + In libjpeg-turbo, JDCT_IFAST is generally about 5-15% faster than + JDCT_ISLOW when using the x86/x86-64 SIMD extensions (results may vary + with other SIMD implementations, or when using libjpeg-turbo without + SIMD extensions.) For quality levels of 90 and below, there should be + little or no perceptible difference between the two algorithms. For + quality levels above 90, however, the difference between JDCT_IFAST and + JDCT_ISLOW becomes more pronounced. With quality=97, for instance, + JDCT_IFAST incurs generally about a 1-3 dB loss (in PSNR) relative to + JDCT_ISLOW, but this can be larger for some images. Do not use + JDCT_IFAST with quality levels above 97. The algorithm often + degenerates at quality=98 and above and can actually produce a more + lossy image than if lower quality levels had been used. Also, in + libjpeg-turbo, JDCT_IFAST is not fully accelerated for quality levels + above 97, so it will be slower than JDCT_ISLOW. JDCT_FLOAT is mainly a + legacy feature. It does not produce significantly more accurate + results than the ISLOW method, and it is much slower. The FLOAT method + may also give different results on different machines due to varying + roundoff behavior, whereas the integer methods should give the same + results on all machines. J_COLOR_SPACE jpeg_color_space int num_components diff --cc usage.txt index 27c4f9c,6752a77..69d4717 --- a/usage.txt +++ b/usage.txt @@@ -51,11 -48,12 +51,11 @@@ This syntax works on all systems, so i The currently supported image file formats are: PPM (PBMPLUS color format), PGM (PBMPLUS grayscale format), BMP, Targa, and RLE (Utah Raster Toolkit - format). (RLE is supported only if the URT library is available.) - cjpeg recognizes the input image format automatically, with the exception - of some Targa-format files. You have to tell djpeg which format to generate. + 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. ++automatically, with the exception of some Targa files. -JPEG files are in the standard JFIF file format. There are other, +JPEG files are in the defacto 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 @@@ -258,57 -280,65 +258,59 @@@ DJPEG DETAIL The basic command line switches for djpeg are: - -colors N Reduce image to at most N colors. This reduces the - or -quantize N number of colors used in the output image, so that it - can be displayed on a colormapped display or stored in - a colormapped file format. For example, if you have - an 8-bit display, you'd need to reduce to 256 or fewer - colors. (-colors is the recommended name, -quantize - is provided only for backwards compatibility.) - - -fast Select recommended processing options for fast, low - quality output. (The default options are chosen for - highest quality output.) Currently, this is equivalent - to "-dct fast -nosmooth -onepass -dither ordered". - - -grayscale Force grayscale output even if JPEG file is color. - Useful for viewing on monochrome displays; also, - djpeg runs noticeably faster in this mode. - - -rgb Force RGB output even if JPEG file is grayscale. - This is provided to support applications that don't - want to cope with grayscale as a separate case. - - -scale M/N Scale the output image by a factor M/N. Currently - supported scale factors are M/N with all M from 1 to - 16, where N is the source DCT size, which is 8 for - baseline JPEG. If the /N part is omitted, then M - specifies the DCT scaled size to be applied on the - given input. For baseline JPEG this is equivalent to - M/8 scaling, since the source DCT size for baseline - JPEG is 8. Scaling is handy if the image is larger - than your screen; also, djpeg runs much faster when - scaling down the output. - - -bmp Select BMP output format (Windows flavor). 8-bit - colormapped format is emitted if -colors or -grayscale - is specified, or if the JPEG file is grayscale; - otherwise, 24-bit full-color format is emitted. - - -gif Select GIF output format. Since GIF does not support - more than 256 colors, -colors 256 is assumed (unless - you specify a smaller number of colors). If you - specify -fast, the default number of colors is 216. - - -os2 Select BMP output format (OS/2 1.x flavor). 8-bit - colormapped format is emitted if -colors or -grayscale - is specified, or if the JPEG file is grayscale; - otherwise, 24-bit full-color format is emitted. - - -pnm Select PBMPLUS (PPM/PGM) output format (this is the - default format). PGM is emitted if the JPEG file is - grayscale or if -grayscale is specified; otherwise - PPM is emitted. - - -rle Select RLE output format. (Requires URT library.) - - -targa Select Targa output format. Grayscale format is - emitted if the JPEG file is grayscale or if - -grayscale is specified; otherwise, colormapped format - is emitted if -colors is specified; otherwise, 24-bit - full-color format is emitted. + -colors N Reduce image to at most N colors. This reduces the + or -quantize N number of colors used in the output image, so that it + can be displayed on a colormapped display or stored in + a colormapped file format. For example, if you have + an 8-bit display, you'd need to reduce to 256 or fewer + colors. (-colors is the recommended name, -quantize + is provided only for backwards compatibility.) + + -fast Select recommended processing options for fast, low + quality output. (The default options are chosen for + highest quality output.) Currently, this is equivalent + to "-dct fast -nosmooth -onepass -dither ordered". + + -grayscale Force grayscale output even if JPEG file is color. + Useful for viewing on monochrome displays; also, + djpeg runs noticeably faster in this mode. + ++ -rgb Force RGB output even if JPEG file is grayscale. ++ + -scale M/N Scale the output image by a factor M/N. Currently + the scale factor must be M/8, where M is an integer + between 1 and 16 inclusive, or any reduced fraction + thereof (such as 1/2, 3/4, etc. Scaling is handy if + the image is larger than your screen; also, djpeg runs + much faster when scaling down the output. + + -bmp Select BMP output format (Windows flavor). 8-bit + colormapped format is emitted if -colors or -grayscale + is specified, or if the JPEG file is grayscale; + otherwise, 24-bit full-color format is emitted. + + -gif Select GIF output format. Since GIF does not support + more than 256 colors, -colors 256 is assumed (unless + you specify a smaller number of colors). If you + specify -fast, the default number of colors is 216. + + -os2 Select BMP output format (OS/2 1.x flavor). 8-bit + colormapped format is emitted if -colors or -grayscale + is specified, or if the JPEG file is grayscale; + otherwise, 24-bit full-color format is emitted. + + -pnm Select PBMPLUS (PPM/PGM) output format (this is the + default format). PGM is emitted if the JPEG file is + grayscale or if -grayscale is specified; otherwise + PPM is emitted. + + -rle Select RLE output format. (Requires URT library.) + + -targa Select Targa output format. Grayscale format is + emitted if the JPEG file is grayscale or if + -grayscale is specified; otherwise, colormapped format + is emitted if -colors is specified; otherwise, 24-bit + full-color format is emitted. Switches for advanced users: @@@ -531,23 -549,32 +536,26 @@@ equivalences between the transformation "-rot 270 -trim" trims only the bottom edge, but "-rot 90 -trim" followed by "-rot 180 -trim" trims both edges. -If you are only interested in perfect transformation, add the -perfect switch: - -perfect Fails with an error if the transformation is not - perfect. -For example you may want to do +If you are only interested in perfect transformations, add the -perfect switch: + -perfect Fail with an error if the transformation is not + perfect. +For example, you may want to do jpegtran -rot 90 -perfect foo.jpg || djpeg foo.jpg | pnmflip -r90 | cjpeg -to do a perfect rotation if available or an approximated one if not. - -We also offer a lossless-crop option, which discards data outside a given -image region but losslessly preserves what is inside. Like the rotate and -flip transforms, lossless crop is restricted by the current JPEG format: the -upper left corner of the selected region must fall on an iMCU boundary. If -this does not hold for the given crop parameters, we silently move the upper -left corner up and/or left to make it so, simultaneously increasing the -region dimensions to keep the lower right crop corner unchanged. (Thus, the -output image covers at least the requested region, but may cover more.) -The adjustment of the region dimensions may be optionally disabled by -attaching an 'f' character ("force") to the width or height number. +to do a perfect rotation, if available, or an approximated one if not. + +This version of jpegtran also offers a lossless crop option, which discards +data outside of a given image region but losslessly preserves what is inside. +Like the rotate and flip transforms, lossless crop is restricted by the current +JPEG format; the upper left corner of the selected region must fall on an iMCU +boundary. If it doesn't, then it is silently moved up and/or left to the - nearest iMCU boundary (the lower right corner is unchanged.) ++nearest iMCU boundary (the lower right corner is unchanged.) Thus, the output ++image covers at least the requested region, but it may cover more. The ++adjustment of the region dimensions may be optionally disabled by attaching an ++'f' character ("force") to the width or height number. The image can be losslessly cropped by giving the switch: - -crop WxH+X+Y Crop to a rectangular subarea of width W, height H - starting at point X,Y. - -A complementary lossless-wipe option is provided to discard (gray out) data -inside a given image region while losslessly preserving what is outside: - -wipe WxH+X+Y Wipe (gray out) a rectangular subarea of - width W, height H starting at point X,Y. + -crop WxH+X+Y Crop to a rectangular region of width W and height H, + starting at point X,Y. Other not-strictly-lossless transformation switches are: @@@ -561,18 -588,30 +569,20 @@@ encoded as a color JPEG. (In such a ca of the near-empty chroma channels won't be large; but the decoding time for a grayscale JPEG is substantially less than that for a color JPEG.) - -scale M/N Scale the output image by a factor M/N. -Currently supported scale factors are M/N with all M from 1 to 16, where N is -the source DCT size, which is 8 for baseline JPEG. If the /N part is omitted, -then M specifies the DCT scaled size to be applied on the given input. For -baseline JPEG this is equivalent to M/8 scaling, since the source DCT size -for baseline JPEG is 8. CAUTION: An implementation of the JPEG SmartScale -extension is required for this feature. SmartScale enabled JPEG is not yet -widely implemented, so many decoders will be unable to view a SmartScale -extended JPEG file at all. - jpegtran also recognizes these switches that control what to do with "extra" markers, such as comment blocks: - -copy none Copy no extra markers from source file. - This setting suppresses all comments - and other metadata in the source file. - -copy comments Copy only comment markers. - This setting copies comments from the source file, - but discards any other metadata. - -copy all Copy all extra markers. This setting preserves - metadata found in the source file, such as JFIF - thumbnails, Exif data, and Photoshop settings. - In some files these extra markers can be sizable. - Note that this option will copy thumbnails as-is; - they will not be transformed. + -copy none Copy no extra markers from source file. This setting - suppresses all comments and other excess baggage - present in the source file. ++ suppresses all comments and other metadata in the ++ source file. + -copy comments Copy only comment markers. This setting copies - comments from the source file but discards - any other data that is inessential for image display. ++ comments from the source file but discards any other ++ metadata. + -copy all Copy all extra markers. This setting preserves + miscellaneous markers found in the source file, such + as JFIF thumbnails, Exif data, and Photoshop settings. + In some files, these extra markers can be sizable. ++ Note that this option will copy thumbnails as-is; ++ they will not be transformed. The default behavior is -copy comments. (Note: in IJG releases v6 and v6a, jpegtran always did the equivalent of -copy none.)