Updated 2014-11-14 00:45:26 by dkf

http://www.jpeg.org/ is the official home for JPEG, a graphical file format that incorporates lossy still image compression. The Img package supports this format.

As of 22 May 2004 JPEG is a module in tcllib that allows one to read and manipulate image information and metadata. Documentation may be found at

The GWImage widget supports this format.

The name comes from the name of the group that developed the format: the Joint Photographic Experts Group. It is extremely well suited to compression of real-world images, though if you intend to do substantial manipulation you are better off using a non-lossy compression scheme instead (such as is found in the TIFF format with the right options.)

Greyscale images are compressible (AIUI) in a lossless fashion as JPEG images; I think this is using a different algorithm and you might need to select the correct algorithm when doing the compression (though some utilities will scan the image first to see if this is possible.) Files in this format frequently have an extension of .jpg .

LV What is jbig ? I've seen a reference to this library in a recent application, but I've not been able to locate a library to build that supports it.

LV Also, what is JPEG 2000? I notice that http://j2000.org/ and http://www.tele.ucl.ac.be/PROJECTS/OPENJPEG/main.html have what appear to be independent toolkits for it. Is anyone doing work to bind it to Tk - perhaps via Tkimg?

TclMagick and Img are useful extensions for working with jpeg files, amongst others. Pixane, part of eTcl, supports reading and writing JPEG too.

LV There appear to be some intellectual property issues outstanding with jpeg. For instance, here is some info that somehow was deleted from this page earlier; I've restored it. If the info was not deleted accidentally, drop me an email so I know not to keep restoring it!

And now, JPEG enters the intellectual properties legal swamp: ... Forgent Sues Over JPEG Patent (Business 2:00 a.m. PDT) http://www.wired.com/news/business/0,1367,63200,00.html

Forgent Networks says it owns a key algorithm in the JPEG picture format, and intends to get 31 of the computing industry's biggest companies to pay for it.

ALOVE Realistically speaking, probably billions of web pages have been using jpegs for many years, so even if this Forgent Networks lawsuit got anywhere, it would be in the courts for years. In other words, don't worry about it. ^_^

LV Actually, the GIF format had just that same situation - and Unisys did just fine squeezing money from software vendors, etc. ...

Even more realisitically - most companies do not wish to take a chance on being dragged into court. So working with the specter of a intellectual properties lawsuit associated with it, many companies will move to something like TIFF or PNG to be safer. Remember - there were millions, if not billions, of GIF files around when UNISYS started their LZW persecution.

ALOVE You have a good point. But fortunately, according to this Wired News item from 2002: http://www.wired.com/news/business/0,1367,53981,00.html the Forgent Patent in question expires "in four years" which would be some time in 2006. So even if the lawsuit succeeds, any software that creates jpegs after 2006 would be free and clear.


On November 1st, Forgent Networks announced that it had settled its lawsuit over the JPEG patents for $8 million. Forgent, an intellectual property firm that licenses communications technology and software for business meetings, announced that it had settled all of the remaining claims in the cases involving U.S. patent number 4,698,672. The company said that the JPEG standard--the image compression mechanism used in digital cameras and PCs--infringed upon the patent, which Forgent acquired in 1997. About 60 companies, including several camera makers, had already cut licensing deals with Forgent. These deals have brought in approximately $110 million in royalties. PC makers, however, balked at licensing deals, which led to the lawsuit. The suit originally involved about 45 defendants, but 15 settled before this final settlement. Forgent claimed the patent was worth around $1 billion. However, the U.S. Patent and Trademark Office agreed to review the validity of the patent in February. Legal fees became mount

Further information may be found at http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=forg&script=410&layout=-6&item_id=925001

LV: Note that the above does not appear to mention that the patent has expired yet...

male - 2007-08-16: Just a question - I haven't examined the sources of the tcllib jpeg package, but ... is it difficult to extent the jpeg package to read the IPTC meta data as well? Or has someone already implemented reading IPTC data using pure tcl?

DKF: As far as I know, what you do is you read the metadata (or the right metadata field?) and interpret it as XML (e.g. using tDOM). Then you can pick the IPTC metadata out of that. But I have not tried this, so I might be way off the mark here. (And, speaking as someone who does a fair bit with XML, the IPTC stuff is massively underdocumented...)

AF I think its XMP data that is XML. IPTC is binary data stored in the 0xED marker segment. and it probably wouldnt be difficult to extend the package to read and write that data but I probably wont be doing it. However its open source so feel free.

LV Recently on comp.lang.tcl, someone was asking for a portable jpg only library. They were considered about the size of the Img library. Anyone know of any work done binding directly to the jpg code?

Note that Img contains the package jpegtcl, which is a Tcl wrapper around the JPEG C library.

See also edit