[comp.sys.next] NeXT's Tiff format

watson@ames.arc.nasa.gov (John S. Watson) (01/03/89)

Hey Folks,

Every image I've seen on the NeXT is stored in a file which name ends 
in ".tiff".  What is the format for "tiff" images?   
Someone told me they thought it might be the same format as the Mac uses.

If possible, could someone send me or post a "tiff.h" file, 
so I can look at it in C.  

Thanks in Advance,
-- 
John S. Watson                                 ARPA: watson@ames.arc.nasa.gov 
NASA Ames Research Center                      UUCP:  ...!ames!watson
Any opinions expressed herein are, like, solely the responsibility of the, like,
author and do not, like, represent the opinions of NASA or the U.S. Government.

edmoy@violet.berkeley.edu (01/04/89)

In article <20213@ames.arc.nasa.gov> watson@ames.arc.nasa.gov (John S. Watson) writes:
>Every image I've seen on the NeXT is stored in a file which name ends 
>in ".tiff".  What is the format for "tiff" images?   
>Someone told me they thought it might be the same format as the Mac uses.

I tried downloading a .tiff file to the Mac, but none of the Mac programs
I've tried (MacVision, Canvas) can read it.  They complain of file format error.
Anyone know why?

Edward Moy				Principal Programmer - Macintosh & Unix
Workstation Support Services		Workstation Software Support Group
University of California
Berkeley, CA  94720

edmoy@violet.Berkeley.EDU
ucbvax!violet!edmoy

ben@rover.uchicago.edu (01/04/89)

In article <18697@agate.BERKELEY.EDU>, edmoy@violet.berkeley.edu writes...
"I tried downloading a .tiff file to the Mac, but none of the Mac programs
"I've tried (MacVision, Canvas) can read it.  They complain of file format error.
"Anyone know why?
" 
"Edward Moy				Principal Programmer - Macintosh & Unix

Oh boy!
TIFF is a tag interface format and any one of the tags can be bad to give you this error.
Also some of the tags could be incompatible with your system..... 
for instance:
    superpaint will read in a tiff file but only if it's a one bit deep bit map (ie. black and white)
    if you try a 8-bit or 4 bit-grey bitmap the Superpaint chokes. and puts up some
    error message. Some programs (Pagemaker, I believe) will ignore some incompatible fields
    ie. you designate the length of the bitmap as 0 instead of the correct size. (this happened to me) 
    Pagemaker displays the image and some garbage that is at the end of the file.  

However, Not having the NeXt tiff images I cannot decode and find the exact problem in them
so sorry.

Ben Herman	ben@rover.uchicago.edu

oster@dewey.soe.berkeley.edu (David Phillip Oster) (01/04/89)

The TIFF format was invented originally for the DEST line of scanners. My
documents say "March 7, 1988, Bear River Associates, Inc., Berkeley,
CA" There is a review article on the subject in a Dr. Dobbs somewhat
less than one year ago.  The spec itself is about 30 pages long and
includes Lempel-Zivv compression as a utility procedure to optionally
compress picture data.  It also includes a portion of the FAX standard as
an optional method of storing picture data.

I only have source for C procedures for version 4 of the spec.  (Bear
River gave them away, for plublicity and to clear space on their
shelves for version 5.)

It is a decent machine-independent standard for scanned, and especially
gray scale or color scanned images.

If you actually use the compression features, you shrink your images to
1/3 or smaller of their original size.  But, the extra cpu time can be
painful.

Conclusion:
If you find ordering nformation for the current standard, please let me
know. I'd like to update my version 4 stuff.

--- David Phillip Oster            --"When we replace the mouse with a pen,
Arpa: oster@dewey.soe.berkeley.edu --3 button mouse fans will need saxophone
Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu --lessons." - Gasee

allen@granite.dec.com (Allen Akin) (01/04/89)

In article <27320@ucbvax.BERKELEY.EDU> David Phillip Oster writes:
>The TIFF format was invented originally for the DEST line of scanners.

	I have a TIFF spec from 1987.  It claims that the format was
	developed by a group of companies, principally Aldus and
	Microsoft.  The format is so baroque and ambiguously specified,
	it should be obvious that Microsoft was involved.  :-)

>If you find ordering nformation for the current standard, please let me
>know. I'd like to update my version 4 stuff.

	You can get a current spec from the Developer Support desk at
	Aldus.  I don't have the phone number at hand, but their
	switchboard operator can forward your call appropriately.
	Aldus is in Seattle (area code 206).

	Allen

w-colinp@microsoft.UUCP (Colin Plumb) (01/04/89)

In article <345@granite.dec.com> allen@decwrl.dec.com (Allen Akin) writes:
>	I have a TIFF spec from 1987.  It claims that the format was
>	developed by a group of companies, principally Aldus and
>	Microsoft.  The format is so baroque and ambiguously specified,
>	it should be obvious that Microsoft was involved.  :-)
                                                           ^^^
No smiley.  It's true, and not funny.  Microsoft's grasp of software
engineering concepts is... tenuous.  That's why I wonder at the sanity
of the people at NeXT who decided to use RTF for the library; I've heard
RTF called the PL/1 of document description languages.
-- 
	-Colin (uunet!microsof!w-colinp)

ali@polya.Stanford.EDU (Ali T. Ozer) (01/04/89)

In article <18697@agate.BERKELEY.EDU> edmoy@violet.berkeley.edu writes:
>I tried downloading a .tiff file to the Mac, but none of the Mac programs
>I've tried (MacVision, Canvas) can read it.  They complain of file format 
>error.
>Edward Moy				Principal Programmer - Macintosh & Unix

NeXT TIFF images will typically have two bits/pixel of gray and 
sometimes two bits/pixel of transparency. Could this be confusing
the Macintosh programs?

You might want to try an .tiff file from the Webster pictures
directory --- I believe those are one bit/pixel and have no alpha.
(The Webster pictures are in /MyDisk/Library/References.)

Ali Ozer, NeXT Developer Support
aozer@NeXT.com

shawn@pnet51.cts.com (Shawn Stanley) (01/05/89)

edmoy@violet.berkeley.edu writes:
>In article <20213@ames.arc.nasa.gov> watson@ames.arc.nasa.gov (John S. Watson) writes:
>>Every image I've seen on the NeXT is stored in a file which name ends 
>>in ".tiff".  What is the format for "tiff" images?   
>>Someone told me they thought it might be the same format as the Mac uses.
>
>I tried downloading a .tiff file to the Mac, but none of the Mac programs
>I've tried (MacVision, Canvas) can read it.  They complain of file format error.
>Anyone know why?

Not to add confusion to the issue, but I dropped by a dealer's shop and used a
scanner/Mac combo to get something for a particular drawing program we use
here at work.  I noticed that the scanner software and a drawing DA on the Mac
that I used with the scanner supported the TIFF format, but those are the only
two programs that I've seen with that option.

UUCP: {rosevax, crash}!orbit!pnet51!shawn
INET: shawn@pnet51.cts.com

edmoy@violet.berkeley.edu (01/05/89)

In article <5883@polya.Stanford.EDU> aozer@NeXT.com (Ali T. Ozer) writes:
>NeXT TIFF images will typically have two bits/pixel of gray and 
>sometimes two bits/pixel of transparency. Could this be confusing
>the Macintosh programs?
>
>You might want to try an .tiff file from the Webster pictures
>directory --- I believe those are one bit/pixel and have no alpha.
>(The Webster pictures are in /MyDisk/Library/References.)

The ones I already did try were:

/MyDisk/Library/References/Webster-Dictionary/pictures/dolphin.tiff
/MyDisk/Library/References/Webster-Dictionary/pictures/humpbackwhale.tiff

and they gave the error message on my Mac II.

Edward Moy				Principal Programmer - Macintosh & Unix
Workstation Support Services		Workstation Software Support Group
University of California
Berkeley, CA  94720

edmoy@violet.Berkeley.EDU
ucbvax!violet!edmoy

edmoy@violet.berkeley.edu (01/06/89)

Here is some more info on the NeXT TIFF question.  To recap, the TIFF files
used in the Webster's dictionary could not be read into MacVision or Canvas
on the Macintosh (both these programs support TIFF, MacVision even creates
TIFF files, that Canvas can read).

I took some TIFF files from a Unix source and most of them could be read
on the Mac using a program called "Retouch".  Only some of these same
TIFF file could be read by Canvas.

Then I copied the TIFF file to the NeXT and made symbolic links from the
Webster's to my own TIFF files.  Webster's couldn't display anymore than
what looked liked random dots on the screen.

I then tried the NeXT TIFF files with Retouch on the Mac, and it failed to
read them also.

If TIFF is a standard, why isn't it standard :-)

Edward Moy				Principal Programmer - Macintosh & Unix
Workstation Support Services		Workstation Software Support Group
University of California
Berkeley, CA  94720

edmoy@violet.Berkeley.EDU
ucbvax!violet!edmoy

ali@polya.Stanford.EDU (Ali T. Ozer) (01/06/89)

In article <18758@agate.BERKELEY.EDU> edmoy@violet.berkeley.edu writes:
> ... the TIFF files
>used in the Webster's dictionary could not be read into MacVision or Canvas
>on the Macintosh (both these programs support TIFF, MacVision even creates
>TIFF files, that Canvas can read).

TIFF files used for Webster use a special compression scheme.
(This was done to reduce the space requirements of the hundreds
of pictures.) Thus TIFF programs on other machines will not
be able to read the Webster pictures.

If you still wish to create standard TIFF (or PS) versions of the
Webster pictures, the best way at the moment is to be to dislay 
the picture and use Scene (in the /MyDisk/Programming/Demos directory)
to grab it. Then you can save it as TIFF, Ascii PS, or Binary PS.
The saved image will have 2 bits per pixel and no alpha.

Another TIFF problem you might run into is that the TIFF routines in
0.8 are only able to read/write TIFF 4.0 files. Thus any TIFF 5.0
files created with a Mac program will not be read in. You should make
sure your programs on other machines save images in TIFF 4.0 format.

Ali Ozer, NeXT Developer Support
aozer@NeXT.com

george@vax5.CIT.CORNELL.EDU (01/07/89)

Just for the record, applescan tiff files can not be read while ast turboscan
files can. I assume this is because of the tiff version 4 vs. 5 problem.

George

jmunkki@kampi.hut.fi (Juri Munkki) (01/07/89)

In article <18758@agate.BERKELEY.EDU> edmoy@violet.berkeley.edu writes:
>Here is some more info on the NeXT TIFF question.  To recap, the TIFF files
>used in the Webster's dictionary could not be read into MacVision or Canvas
>on the Macintosh (both these programs support TIFF, MacVision even creates
>TIFF files, that Canvas can read).
...
>If TIFF is a standard, why isn't it standard :-)

The TIFF standard is quite large. TIFF comes from the words Tag Image File
Format. These tags are some kind of opcodes that a program should read and
write. Some common problems when opening TIFF files:

  a)  Byte ordering.
	The first two bytes of a TIFF file specify the byte ordering.
	II is intel style, MM is for Motorola. Apple and NeXT use
	Motorola processors: the files should begin with "MM".

  b)  Bitmap depth.
	A TIFF file is usually 8-bit or single-bit on the Macintosh.
	Some programs also support 4-bit files, but simple paint/draw
	programs usually support only single-bit images. The version
	of canvas that we have seems to support only 1-bit images.
	ImageStudio reads at least 1-bit and 8-bit, but writes only
	8-bit TIFF. Since NeXT machines have a 2-bit deep display,
	they might use 2-bit deep TIFF, although I doubt it, since
	they are using the grayscales for the user interface.

  c)  Packing
	The TIFF standard recognizes several different packing methods.
	Most scanner programs create unpacked files and most programs
	seem to be able to read these. Macintosh programmers are most
	familiar with PackBits...unfortunately it is only one of many
	possible formats.

The best way to verify that a file is really TIFF, seems to be to
include it into a Pagemaker document. Since Aldus and Microsoft are
the strongest supporters of the standard, their implementations for
reading these files should be pretty complete.

The problem with NeXT TIFF is probably packing. They might be using
a very advanced packing algorithm to save disp space.

Disclaimer: I read the TIFF standard documentation about a year ago.
	    I might not have all my facts straight, since I didn't
	    bother to dig up the document.

TIFF standard specifications have been posted to comp.graphics and
some mac group less than six months ago.

_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
|     Juri Munkki jmunkki@hut.fi  jmunkki@fingate.bitnet        I Want   Ne   |
|     Helsinki University of Technology Computing Centre        My Own   XT   |
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~

mbk@hpsemc.HP.COM (Miles Kehoe) (01/10/89)

.TIFF files used for Webster use a special compression scheme.
.(This was done to reduce the space requirements of the hundreds
.of pictures.) Thus TIFF programs on other machines will not
.be able to read the Webster pictures.

.Ali Ozer, NeXT Developer Support


Ali, is the compression scheme other than one of those described
in the TIFF spec? As i recall, the spec describes 4 possible
values for tag 0x103:  1, No compression.  2, CCITT modified
Huffman run length encoding. 5, LZW compression.  32773,'packbits'
a la mac.  

Are you using another packing algorithm?? Is it documented for
public consumption?

Thanks,

Miles Kehoe

ali@polya.Stanford.EDU (Ali T. Ozer) (01/12/89)

In article <14290002@hpsemc.HP.COM> mbk@hpsemc.HP.COM (Miles Kehoe) writes:
>Ali, is the compression scheme other than one of those described
>in the TIFF spec? As i recall, the spec describes 4 possible
>values for tag 0x103:  1, No compression.  2, CCITT modified
>Huffman run length encoding. 5, LZW compression.  32773,'packbits'
>a la mac.  

The compression scheme is different than any described in the TIFF specs;
it's one that worked best for Webster pictures. It's not documented with
the 0.8 documentation.

Ali Ozer, NeXT Developer Support
aozer@NeXT.com

mbk@hpsemc.HP.COM (Miles Kehoe) (01/14/89)

>The compression scheme is different than any described in the TIFF specs;
>it's one that worked best for Webster pictures. It's not documented with
>the 0.8 documentation.

OK, thanks. Just for fun, do you implement a different value for
the compression tag code, or is it tagged in a 'private tag'?

mbk