1The Independent JPEG Group's JPEG software 2========================================== 3 4Note: Greyscale downsampling patch of 12/21 has been applied to 5 jdmaster.c and jcmaster.c. --jhb 6 7 8README for release 5a of 7-Dec-94 9================================= 10 11This distribution contains the fifth public release of the Independent JPEG 12Group's free JPEG software. You are welcome to redistribute this software and 13to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. 14 15Serious users of this software (particularly those incorporating it into 16larger programs) should contact IJG at jpeg-info@uunet.uu.net to be added to 17our electronic mailing list. Mailing list members are notified of updates 18and have a chance to participate in technical discussions, etc. 19 20This software is the work of Tom Lane, Philip Gladstone, Luis Ortiz, Jim 21Boucher, Lee Crocker, George Phillips, Davide Rossi, Ge' Weijers, and other 22members of the Independent JPEG Group. 23 24IJG is not associated with the official ISO JPEG standards committee. 25 26 27DOCUMENTATION ROADMAP 28===================== 29 30This file contains the following sections: 31 32OVERVIEW General description of JPEG and the IJG software. 33LEGAL ISSUES Copyright, lack of warranty, terms of distribution. 34REFERENCES Where to learn more about JPEG. 35ARCHIVE LOCATIONS Where to find newer versions of this software. 36RELATED SOFTWARE Other stuff you should get. 37FILE FORMAT WARS Software *not* to get. 38TO DO Plans for future IJG releases. 39 40Other documentation files in the distribution are: 41 42User documentation: 43 install.doc How to configure and install the IJG software. 44 usage.doc Usage instructions for cjpeg, djpeg, rdjpgcom, wrjpgcom. 45 *.1 Unix-style man pages for programs (same info as usage.doc). 46 change.log Version-to-version change highlights. 47Programmer and internal documentation: 48 libjpeg.doc How to use the JPEG library in your own programs. 49 example.c Sample code for calling the JPEG library. 50 structure.doc Overview of the JPEG library's internal structure. 51 filelist.doc Road map of IJG files. 52 coderules.doc Coding style rules --- please read if you contribute code. 53 54Please read at least the files install.doc and usage.doc. Useful information 55can also be found in the JPEG FAQ (Frequently Asked Questions) article. See 56ARCHIVE LOCATIONS below to find out where to obtain the FAQ article. 57 58If you want to understand how the JPEG code works, we suggest reading one or 59more of the REFERENCES, then looking at the documentation files (in roughly 60the order listed) before diving into the code. 61 62 63OVERVIEW 64======== 65 66This package contains C software to implement JPEG image compression and 67decompression. JPEG (pronounced "jay-peg") is a standardized compression 68method for full-color and gray-scale images. JPEG is intended for compressing 69"real-world" scenes; cartoons and other non-realistic images are not its 70strong suit. JPEG is lossy, meaning that the output image is not necessarily 71identical to the input image. Hence you must not use JPEG if you have to have 72identical output bits. However, on typical images of real-world scenes, very 73good compression levels can be obtained with no visible change, and amazingly 74high compression levels are possible if you can tolerate a low-quality image. 75For more details, see the references, or just experiment with various 76compression settings. 77 78We provide a set of library routines for reading and writing JPEG image files, 79plus two simple applications "cjpeg" and "djpeg", which use the library to 80perform conversion between JPEG and some other popular image file formats. 81The library is intended to be reused in other applications. 82 83This software implements JPEG baseline and extended-sequential compression 84processes. Provision is made for supporting all variants of these processes, 85although some uncommon parameter settings aren't implemented yet. For legal 86reasons, we are not distributing code for the arithmetic-coding process; see 87LEGAL ISSUES. At present we have made no provision for supporting the 88progressive, hierarchical, or lossless processes defined in the standard. 89(Support for progressive mode may be offered in a future release.) 90 91In order to support file conversion and viewing software, we have included 92considerable functionality beyond the bare JPEG coding/decoding capability; 93for example, the color quantization modules are not strictly part of JPEG 94decoding, but they are essential for output to colormapped file formats or 95colormapped displays. These extra functions can be compiled out of the 96library if not required for a particular application. We have also included 97two simple applications for inserting and extracting textual comments in 98JFIF files. 99 100The emphasis in designing this software has been on achieving portability and 101flexibility, while also making it fast enough to be useful. In particular, 102the software is not intended to be read as a tutorial on JPEG. (See the 103REFERENCES section for introductory material.) While we hope that the entire 104package will someday be industrial-strength code, much remains to be done in 105performance tuning and in improving the capabilities of individual modules. 106 107We welcome the use of this software as a component of commercial products. 108No royalty is required, but we do ask for an acknowledgement in product 109documentation, as described under LEGAL ISSUES. 110 111 112LEGAL ISSUES 113============ 114 115In plain English: 116 1171. We don't promise that this software works. (But if you find any bugs, 118 please let us know!) 1192. You can use this software for whatever you want. You don't have to pay us. 1203. You may not pretend that you wrote this software. If you use it in a 121 program, you must acknowledge somewhere in your documentation that 122 you've used the IJG code. 123 124In legalese: 125 126The authors make NO WARRANTY or representation, either express or implied, 127with respect to this software, its quality, accuracy, merchantability, or 128fitness for a particular purpose. This software is provided "AS IS", and you, 129its user, assume the entire risk as to its quality and accuracy. 130 131This software is copyright (C) 1991, 1992, 1993, 1994, Thomas G. Lane. 132All Rights Reserved except as specified below. 133 134Permission is hereby granted to use, copy, modify, and distribute this 135software (or portions thereof) for any purpose, without fee, subject to these 136conditions: 137(1) If any part of the source code for this software is distributed, then this 138README file must be included, with this copyright and no-warranty notice 139unaltered; and any additions, deletions, or changes to the original files 140must be clearly indicated in accompanying documentation. 141(2) If only executable code is distributed, then the accompanying 142documentation must state that "this software is based in part on the work of 143the Independent JPEG Group". 144(3) Permission for use of this software is granted only if the user accepts 145full responsibility for any undesirable consequences; the authors accept 146NO LIABILITY for damages of any kind. 147 148These conditions apply to any software derived from or based on the IJG code, 149not just to the unmodified library. If you use our work, you ought to 150acknowledge us. 151 152Permission is NOT granted for the use of any IJG author's name or company name 153in advertising or publicity relating to this software or products derived from 154it. This software may be referred to only as "the Independent JPEG Group's 155software". 156 157We specifically permit and encourage the use of this software as the basis of 158commercial products, provided that all warranty or liability claims are 159assumed by the product vendor. 160 161 162ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, 163sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. 164ansi2knr.c is NOT covered by the above copyright and conditions, but instead 165by the usual distribution terms of the Free Software Foundation; principally, 166that you must include source code if you redistribute it. (See the file 167ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part 168of any program generated from the IJG code, this does not limit you more than 169the foregoing paragraphs do. 170 171The configuration script "configure" was produced with GNU Autoconf. It 172is copyright by the Free Software Foundation but is freely distributable. 173 174It appears that the arithmetic coding option of the JPEG spec is covered by 175patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot 176legally be used without obtaining one or more licenses. For this reason, 177support for arithmetic coding has been removed from the free JPEG software. 178(Since arithmetic coding provides only a marginal gain over the unpatented 179Huffman mode, it is unlikely that very many implementations will support it.) 180So far as we are aware, there are no patent restrictions on the remaining 181code. 182 183We are required to state that 184 "The Graphics Interchange Format(c) is the Copyright property of 185 CompuServe Incorporated. GIF(sm) is a Service Mark property of 186 CompuServe Incorporated." 187 188 189REFERENCES 190========== 191 192We highly recommend reading one or more of these references before trying to 193understand the innards of the JPEG software. 194 195The best short technical introduction to the JPEG compression algorithm is 196 Wallace, Gregory K. "The JPEG Still Picture Compression Standard", 197 Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. 198(Adjacent articles in that issue discuss MPEG motion picture compression, 199applications of JPEG, and related topics.) If you don't have the CACM issue 200handy, a PostScript file containing a revised version of Wallace's article 201is available at ftp.uu.net, graphics/jpeg/wallace.ps.gz. The file (actually 202a preprint for an article that appeared in IEEE Trans. Consumer Electronics) 203omits the sample images that appeared in CACM, but it includes corrections 204and some added material. Note: the Wallace article is copyright ACM and 205IEEE, and it may not be used for commercial purposes. 206 207A somewhat less technical, more leisurely introduction to JPEG can be found in 208"The Data Compression Book" by Mark Nelson, published by M&T Books (Redwood 209City, CA), 1991, ISBN 1-55851-216-0. This book provides good explanations and 210example C code for a multitude of compression methods including JPEG. It is 211an excellent source if you are comfortable reading C code but don't know much 212about data compression in general. The book's JPEG sample code is far from 213industrial-strength, but when you are ready to look at a full implementation, 214you've got one here... 215 216The best full description of JPEG is the textbook "JPEG Still Image Data 217Compression Standard" by William B. Pennebaker and Joan L. Mitchell, published 218by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. Price US$59.95, 638 pp. 219The book includes the complete text of the ISO JPEG standards (DIS 10918-1 220and draft DIS 10918-2). This is by far the most complete exposition of JPEG 221in existence, and we highly recommend it. 222 223The JPEG standard itself is not available electronically; you must order a 224paper copy through ISO. (Unless you feel a need to own a certified official 225copy, we recommend buying the Pennebaker and Mitchell book instead; it's much 226cheaper and includes a great deal of useful explanatory material.) In the US, 227copies of the standard may be ordered from ANSI Sales at (212) 642-4900, or 228from Global Engineering Documents at (800) 854-7179. (ANSI doesn't take 229credit card orders, but Global does.) It's not cheap: as of 1992, ANSI was 230charging $95 for Part 1 and $47 for Part 2, plus 7% shipping/handling. The 231standard is divided into two parts, Part 1 being the actual specification, 232while Part 2 covers compliance testing methods. Part 1 is titled "Digital 233Compression and Coding of Continuous-tone Still Images, Part 1: Requirements 234and guidelines" and has document number ISO/IEC IS 10918-1. As of mid-1994, 235Part 2 is still at Draft International Standard status. It is titled "Digital 236Compression and Coding of Continuous-tone Still Images, Part 2: Compliance 237testing" and has document number ISO/IEC DIS 10918-2. (The document number 238will change to IS 10918-2 when final approval is obtained.) A Part 3, 239covering extensions, is likely to appear in draft form in late 1994. 240 241The JPEG standard does not specify all details of an interchangeable file 242format. For the omitted details we follow the "JFIF" conventions, revision 2431.02. A copy of the JFIF spec is available from: 244 Literature Department 245 C-Cube Microsystems, Inc. 246 1778 McCarthy Blvd. 247 Milpitas, CA 95035 248 phone (408) 944-6300, fax (408) 944-6314 249A PostScript version of this document is available at ftp.uu.net, file 250graphics/jpeg/jfif.ps.gz. It can also be obtained by e-mail from the C-Cube 251mail server, netlib@c3.pla.ca.us. Send the message "send jfif_ps from jpeg" 252to the server to obtain the JFIF document; send the message "help" if you have 253trouble. 254 255The TIFF 6.0 file format specification can be obtained by FTP from sgi.com 256(192.48.153.1), file graphics/tiff/TIFF6.ps.Z; or you can order a printed copy 257from Aldus Corp. at (206) 628-6593. It should be noted that the TIFF 6.0 spec 258of 3-June-92 has a number of serious problems in its JPEG features. A 259redesign effort is currently underway to correct these problems; it is 260expected to result in a new, incompatible, spec. IJG intends to support the 261corrected version of TIFF when the new spec is issued. 262 263 264ARCHIVE LOCATIONS 265================= 266 267The "official" archive site for this software is ftp.uu.net (Internet 268address 192.48.96.9). The most recent released version can always be found 269there in directory graphics/jpeg. This particular version will be archived 270as graphics/jpeg/jpegsrc.v5a.tar.gz. If you are on the Internet, you 271can retrieve files from ftp.uu.net by standard anonymous FTP. If you don't 272have FTP access, UUNET's archives are also available via UUCP; contact 273help@uunet.uu.net for information on retrieving files that way. 274 275Numerous Internet sites maintain copies of the UUNET files; in particular, 276you can probably find a copy at any site that archives comp.sources.misc 277submissions. However, only ftp.uu.net is guaranteed to have the latest 278official version. 279 280You can also obtain this software from CompuServe, in the GRAPHSUPPORT 281forum (GO GRAPHSUP), probably in library 15 (there are rumors of a pending 282reorganization there). Again, CompuServe is not guaranteed to have the 283very latest version. 284 285The JPEG FAQ (Frequently Asked Questions) article is a useful source of 286general information about JPEG. It is updated constantly and therefore is 287not included in this distribution. The FAQ is posted every two weeks to 288Usenet newsgroups comp.graphics, news.answers, and other groups. You can 289always obtain the latest version from the news.answers archive at 290rtfm.mit.edu. By FTP, fetch /pub/usenet/news.answers/jpeg-faq/part1 and 291.../part2. If you don't have FTP, send e-mail to mail-server@rtfm.mit.edu 292with body 293 send usenet/news.answers/jpeg-faq/part1 294 send usenet/news.answers/jpeg-faq/part2 295 296 297RELATED SOFTWARE 298================ 299 300Numerous viewing and image manipulation programs now support JPEG. (Quite a 301few of them use this library to do so.) The JPEG FAQ described above lists 302some of the more popular free and shareware viewers, and tells where to 303obtain them on Internet. 304 305If you are on a Unix machine, we highly recommend Jef Poskanzer's free 306PBMPLUS image software, which provides many useful operations on PPM-format 307image files. In particular, it can convert PPM images to and from a wide 308range of other formats. You can obtain this package by FTP from ftp.x.org 309(contrib/pbmplus*.tar.Z) or ftp.ee.lbl.gov (pbmplus*.tar.Z). There is also 310a newer update of this package called NETPBM, available from 311wuarchive.wustl.edu under directory /graphics/graphics/packages/NetPBM/. 312Unfortunately PBMPLUS/NETPBM is not nearly as portable as the IJG software 313is; you are likely to have difficulty making it work on any non-Unix machine. 314 315A different free JPEG implementation, written by the PVRG group at Stanford, 316is available from havefun.stanford.edu in directory pub/jpeg. This program 317is designed for research and experimentation rather than production use; 318it is slower, harder to use, and less portable than the IJG code, but it 319implements a larger subset of the JPEG standard. In particular, it supports 320lossless JPEG. 321 322 323FILE FORMAT WARS 324================ 325 326Some JPEG programs produce files that are not compatible with our library. 327The root of the problem is that the ISO JPEG committee failed to specify a 328concrete file format. Some vendors "filled in the blanks" on their own, 329creating proprietary formats that no one else could read. (For example, none 330of the early commercial JPEG implementations for the Macintosh were able to 331exchange compressed files.) 332 333The file format we have adopted is called JFIF (see REFERENCES). This format 334has been agreed to by a number of major commercial JPEG vendors, and it has 335become the de facto standard. JFIF is a minimal or "low end" representation. 336Work is also going forward to incorporate JPEG compression into the TIFF 337standard, for use in "high end" applications that need to record a lot of 338additional data about an image. We intend to support TIFF in the future. 339We hope that these two formats will be sufficient and that other, 340incompatible JPEG file formats will not proliferate. 341 342Indeed, part of the reason for developing and releasing this free software is 343to help force rapid convergence to de facto standards for JPEG file formats. 344SUPPORT STANDARD, NON-PROPRIETARY FORMATS: demand JFIF or TIFF/JPEG! 345 346 347TO DO 348===== 349 350In future versions, we are considering supporting progressive JPEG 351compression, the upcoming JPEG Part 3 extensions, and other improvements. 352 353As always, speeding things up is high on our priority list. 354 355Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net. 356