2001.10.03 19:05 "OJPEG & Wang Images (long)", by Scott Marovich

2001.10.03 19:05 "OJPEG & Wang Images (long)", by Scott Marovich

During the past year or so, there have been frequent queries to this discussion group about the TIFF Library's capacity to manipulate files created according to the now-deprecated TIFF Version 6 method of encapsulating JPEG-compressed images. Many complaints arise from continuing use of the apparently-popular "Imaging for Windows" application, shipped by Microsoft (but not developed by them; see below), which generates this obsolete format. As the developer of the TIFF Library's new "tif_ojpeg.c" module, recently added in order to handle some of these cases, let me offer a brief summary of where we are in this effort, together with some suggestions about how our user community might proceed in the future. As a point of information, I don't monitor this discussion group regularly--my work schedule is too full--so if you have any "burning issues" in this regard (but no flames, please!) kindly E-mail me directly.

First, let me publicly thank several other developers who helped me by providing testing, test images, constructive criticism, and advice; in alphabetical order: Charles Auer <Bumble731@msn.com>, Mikhael Bolgov <mikef@fcoder.com>, Rex Joliff <Rex_Joliff@notes.ymp.gov>, Chris Losinger <closinger@checkfreesvcs.com>, and Frank Warmerdam <warmerdam@pobox.com>. Of course, any remaining bugs in the code are strictly my own!

Second, for the benefit of other readers who might be tempted to send queries and complaints about why these files often cannot be processed correctly, let me once again point out that:

  1. The method of JPEG encapsulation specified by TIFF Version 6 is obsolete and deprecated. If you are writing a new application, DON'T USE IT!
  2. The TIFF Library does not, and will never, provide full support for this format. My goal was merely to read a few old but widely copied specimens of this format, NOT to write/copy them or support the creation of new ones.
  3. Draft "TIFF Technical Note No. 2" provides an excellent explanation of what's wrong with the TIFF Version 6 scheme, how/why your old JPEG-in-TIFF files can break, and--for new-application developers--what to do instead. PLEASE READ IT before sending a query!

The "executive summary" of (3) for most Wang "Imaging for Windows" questions is: several tags in the TIFF Version 6 format are file-relative Byte offsets to JPEG data, not the data itself; so, if you re-format a file in any way (or extract a TIFF directory from a multi-image file), your application MUST find and relocate BOTH this data AND the offsets referring to it. Most applications don't, and the TIFF Library doesn't either, so doing anything to these files other than view them is almost certain to break something. This why the TIFF Version 6 JPEG- encapsulation format is deprecated. If you're writing new software to produce TIFF files, DON'T USE IT! Use the recommended JFIF-in-TIFF format instead.

I'm an old UNIX hacker who knows little about world of Wintel software (I wrote "tif_ojpeg.c" to improve the popular "xv(1)" viewer for my local users), but I became curious about where those grotty Wang TIFF files are coming from, so I asked a coworker for a "guided tour" of his PCs in order to find information about this software: who wrote it, and why any sensible person would use it. Please pardon me if this repeats what you already know, but I learned several interesting things:

Windows '98 does indeed squirrel away the software in an "NT Applications" folder as "wangimg.exe", and its version/contact pop-up windows show that it was released in 1996 by Wang Laboratories of Billerica, Massachusetts, now out of business. Windows 2000 has a newer version, officially called "Imaging for Windows" and also stored as "wangimg.exe", but its version/contact windows say that it was released in 1999 by Eastman Software, a division of Eastman Kodak also located in Billerica (did they buy a chunk of Wang Computer Corp. during the latter's bankruptcy?), which has just been sold to "eiStream Technologies, Inc." of Dallas, Texas. Until they re-register the Domain name(!), more information about this application is available at the URL:

http://www.eastmansoftware.com -> [Products] -> [Imaging]

They advertise something called "Imaging for Windows Professional Edition (PRO)" and I dunno whether the freebie pre-installed on Windows is the same thing or a downgraded "consumer edition".

My coworker and I played a little with the latter, and we found that it had rather limited functionality in comparison to either Microsoft's Photo Editor or the old DOS "paint" program, which seems to have been resurrected for Windows XP; apparently it can only read a limited range of image file formats, including GIF, TIFF, and some compressed FAX formats--but not raw JPEG or JFIF. It can create TIFF files either with or without JPEG compression; its JPEG-in-TIFF encapsulation format is obsolete, but we found we could write an uncompressed TIFF, then let Photo Editor read it and re-write it, apparently yielding clean, modern-format files.

So, why would anyone continue to use this thing? As far as I can tell, its only advantages in comparison to Photo Editor and other pre-installed Windows software seem to be:

Hence, it seems to me that there might be two possible ways in which the open- software community could address this Wang-image portability mess at its source; either:

  1. If Windows has any other pre-installed ("free") software that provides a viable alternative to "Imaging for Windows", especially for scanner-to-TIFF JPEG encapsulations, then I think we could help ourselves by figuring out an alternative recommendation for our Wintel-dependent colleagues. Can any reader of this discussion group offer reasonable proposals?
  2. If someone could locate a receptive technical contact in eiStream, perhaps we could encourage an update of its TIFF output format in the next version of their Windows product. Do any of you represent large commercial customers who could do that? (I assume that individual consumers would have no clout.)

In summary, the TIFF Library will never be able to correctly write or copy a TIFF Version 6 JPEG encapsulation, or extract one from a multi-image file, so stop asking! Instead, most of us who've examined the problem think that a better solution is: encourage/assist software vendors who still generate this obsolete format to please update their products. TIFF Library support is--and should remain--limited to reading old, "legacy" images that can't be handled in any other way.

Scott Marovich               Hewlett-Packard Laboratories M/S 4U12
E-mail: marovich@hpl.hp.com  P.O. Box 10490 (1501 Page Mill Road)
HP TELNET 857-2998           Palo Alto CA 94303-0971 U.S.A.
Tel. (650)857-2998           FAX (650)857-7724