diff --git a/README.ijg b/README.ijg index 3a0076343..9c450ceb0 100644 --- a/README.ijg +++ b/README.ijg @@ -128,7 +128,7 @@ with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. -This software is copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding. +This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding. All Rights Reserved except as specified below. Permission is hereby granted to use, copy, modify, and distribute this @@ -166,11 +166,11 @@ ltmain.sh). Another support script, install-sh, is copyright by X Consortium 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 @@ -189,8 +189,8 @@ The best short technical introduction to the JPEG compression algorithm is Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. (Adjacent articles in that issue discuss MPEG motion picture compression, applications of JPEG, and related topics.) If you don't have the CACM issue -handy, a PostScript file containing a revised version of Wallace's article is -available at http://www.ijg.org/files/wallace.ps.gz. The file (actually +handy, a PDF file containing a revised version of Wallace's article is +available at http://www.ijg.org/files/Wallace.JPEG.pdf. The file (actually a preprint for an article that appeared in IEEE Trans. Consumer Electronics) omits the sample images that appeared in CACM, but it includes corrections and some added material. Note: the Wallace article is copyright ACM and IEEE, @@ -246,9 +246,7 @@ ARCHIVE LOCATIONS 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. +directory "files". The JPEG FAQ (Frequently Asked Questions) article is a source of some general information about JPEG. diff --git a/change.log b/change.log index b60ddd686..563648a16 100644 --- a/change.log +++ b/change.log @@ -4,6 +4,23 @@ information relevant to libjpeg-turbo. CHANGE LOG for Independent JPEG Group's JPEG software +Version 9b 17-Jan-2016 +----------------------- + +Document 'f' specifier for jpegtran -crop specification. +Thank to Michele Martone for suggestion. + + +Version 9 13-Jan-2013 +---------------------- + +Add remark for jpeg_mem_dest() in jdatadst.c. +Thank to Elie-Gregoire Khoury for the hint. + +Correct argument type in format string, avoid compiler warnings. +Thank to Vincent Torri for hint. + + Version 8d 15-Jan-2012 ----------------------- diff --git a/djpeg.c b/djpeg.c index 93567c687..80f620ffd 100644 --- a/djpeg.c +++ b/djpeg.c @@ -3,6 +3,7 @@ * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. + * Modified 2013 by Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright (C) 2010-2011, 2013-2015, D. R. Commander. * Copyright (C) 2015, Google, Inc. @@ -373,7 +374,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, /* Scale the output image by a fraction M/N. */ 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) != 2) usage(); diff --git a/jdarith.c b/jdarith.c index a9a6ec6b6..83a05c697 100644 --- a/jdarith.c +++ b/jdarith.c @@ -2,7 +2,7 @@ * 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. * libjpeg-turbo Modifications: * Copyright (C) 2015, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg @@ -97,7 +97,7 @@ get_byte (j_decompress_ptr cinfo) * (instead of fixed) with the bit shift counter CT. * Thus, we also need only one (variable instead of * fixed size) shift for the LPS/MPS decision, and - * we can get away with any renormalization update + * we can do away with any renormalization update * of C (except for new data insertion, of course). * * I've also introduced a new scheme for accessing diff --git a/jdatadst.c b/jdatadst.c index f078b7d16..ddaf080e0 100644 --- a/jdatadst.c +++ b/jdatadst.c @@ -238,6 +238,9 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile) * larger memory, so the buffer is available to the application after * finishing compression, and then the application is responsible for * freeing the requested memory. + * Note: An initial buffer supplied by the caller is expected to be + * managed by the application. The library does not free such buffer + * when allocating a larger buffer. */ GLOBAL(void) diff --git a/jpegtran.1 b/jpegtran.1 index 5b8e1263a..7f3c8531e 100644 --- a/jpegtran.1 +++ b/jpegtran.1 @@ -1,4 +1,4 @@ -.TH JPEGTRAN 1 "21 November 2014" +.TH JPEGTRAN 1 "18 February 2016" .SH NAME jpegtran \- lossless transformation of JPEG files .SH SYNOPSIS @@ -19,6 +19,10 @@ for example from baseline JPEG to progressive JPEG or vice versa. It can also perform some rearrangements of the image data, for example turning an image from landscape to portrait format by rotation. .PP +For EXIF files and JPEG files containing Exif data, you may prefer to use +.B exiftran +instead. +.PP .B jpegtran works by rearranging the compressed data (DCT coefficients), without ever fully decoding the image. Therefore, its transformations are lossless: @@ -28,7 +32,11 @@ followed by .B cjpeg to accomplish the same conversion. But by the same token, .B jpegtran -cannot perform lossy operations such as changing the image quality. +cannot perform lossy operations such as changing the image quality. However, +while the image data is losslessly transformed, metadata can be removed. See +the +.B \-copy +option for specifics. .PP .B jpegtran reads the named JPEG/JFIF file, or the standard input if no file is @@ -150,6 +158,18 @@ For example, you may want to do .B | pnmflip \-r90 | cjpeg) .IP to do a perfect rotation, if available, or an approximated one if not. +.PP +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 the image to a rectangular region of width W and height H, starting at @@ -180,16 +200,17 @@ 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 -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 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 +option will copy thumbnails as-is; they will not be transformed. .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.) diff --git a/jversion.h b/jversion.h index dfea37893..d05a95961 100644 --- a/jversion.h +++ b/jversion.h @@ -26,7 +26,7 @@ #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" \ diff --git a/libjpeg.txt b/libjpeg.txt index d1f641797..58f11b318 100644 --- a/libjpeg.txt +++ b/libjpeg.txt @@ -1,7 +1,7 @@ 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. libjpeg-turbo Modifications: Copyright (C) 2010, 2014, 2015, D. R. Commander. Copyright (C) 2015, Google, Inc. @@ -916,6 +916,10 @@ jpeg_simple_progression (j_compress_ptr cinfo) Compression parameters (cinfo fields) include: +boolean arith_code + If TRUE, use arithmetic coding. + If FALSE, use Huffman coding. + J_DCT_METHOD dct_method Selects the algorithm used for the DCT step. Choices are: JDCT_ISLOW: slow but accurate integer algorithm diff --git a/usage.txt b/usage.txt index 27c4f9ce0..69d4717a7 100644 --- a/usage.txt +++ b/usage.txt @@ -51,9 +51,9 @@ This syntax works on all systems, so it is useful for scripts. 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 files. 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. @@ -275,6 +275,8 @@ The basic command line switches for djpeg are: 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 @@ -425,8 +427,9 @@ it may run out of memory even with -maxmemory 0. In that case you can still decompress, with some loss of image quality, by specifying -onepass for one-pass quantization. -To avoid the Unisys LZW patent, djpeg produces uncompressed GIF files. These -are larger than they should be, but are readable by standard GIF decoders. +To avoid the Unisys LZW patent (now expired), djpeg produces uncompressed GIF +files. These are larger than they should be, but are readable by standard GIF +decoders. HINTS FOR BOTH PROGRAMS @@ -468,14 +471,16 @@ jpegtran performs various useful transformations of JPEG files. It can translate the coded representation from one variant of JPEG to another, for example from baseline JPEG to progressive JPEG or vice versa. It can also perform some rearrangements of the image data, for example turning an image -from landscape to portrait format by rotation. +from landscape to portrait format by rotation. For EXIF files and JPEG files +containing Exif data, you may prefer to use exiftran instead. jpegtran works by rearranging the compressed data (DCT coefficients), without ever fully decoding the image. Therefore, its transformations are lossless: there is no image degradation at all, which would not be true if you used djpeg followed by cjpeg to accomplish the same conversion. But by the same token, jpegtran cannot perform lossy operations such as changing the image -quality. +quality. However, while the image data is losslessly transformed, metadata +can be removed. See the -copy option for specifics. jpegtran uses a command line syntax similar to cjpeg or djpeg. On Unix-like systems, you say: @@ -543,7 +548,10 @@ 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 region of width W and height H, @@ -564,15 +572,17 @@ a grayscale JPEG is substantially less than that for a color JPEG.) 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 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.)