[comp.sys.next] tiff images reverse polarity...

aozer@next.com (Ali Ozer) (01/15/91)

[Apologies to those seeing this message twice... -Ali]

In article <642@caslon.cs.arizona.edu> Matthew L. Demsey writes:
>In article <977.278cb6ef@amy.skidmore.edu>, tholland@amy.skidmore.edu writes:
>> I had some tiff files of scanned B&W photos stored on my disk.
>> Under 1.0 they looked fine, but when I upgraded today, all the
>> photos now look like negatives.
>  I also have had this problem, except i had scanned them on a
>Mac and then transferred then to the NeXT - i had just assumed
>it was another case of Mac screwing something up - but now i 
>suspect that it may be inherent to 2.0..

I just got a hold of some of these TIFFs (Many thanks to Anthony
Holland and Matthew Demsey), and there seems to be two kinds.

The first kind lacks the the photometric field which indicates how the bits 
are to be treated. For instance, if you have only one sample per pixel, your
image is probably grayscale. How should the "0" pixel value be treated as:
white or black?  About this field the TIFF standard says

  No default.   That  means that  if you  care  if  your  image  is
  displayed and  printed as  "normal" vs "inverted," you must write
  out this  field.   Do not rely on applications defaulting to what
  you want! ...

If a monochrome TIFF file lacks the photometric field release 2.0 treats the
data in "min-is-white" sense.  This works most of the time (although most
of the images generated on the NeXT are "min-is-black," most of the images
generated without the photometric have so far turned out to be "min-is-white").
Unfortunately, the demo app Icon displays these images in "min-is-black" mode.
I believe this was the problem with some of the images sent to me; they
appeared negative in Icon but looked fine in Mail, Workspace inspector, etc.

The second kind of file I received does have the photometric interpretation
field; however, the sense is wrong! The file claims min-is-black, but
if you display the data using min-is-black, it appears inverted.  I believe
you can create this type of file if you load one of the above files into
Icon and then Save. Files like this would appear inverted under both 1.0 
and 2.0, and there's a TIFF loader can do to detect the problem (well, maybe
a bit of image analysis and recognition could help).

The best solution is to fix these files, probably through an app which
inserts a photometric value in the TIFF and lets the user toggle it until the 
image looks right. Is something like this available?

Ali (Ali_Ozer@NeXT.com)