1993.09.26 21:12 "Help needed with tiff files...", by Manavendra Misra

1993.09.27 23:10 "Re: Help needed with tiff files...", by Sam Leffler

Hi! I am having some problems in handling color-maps in tiff files, and was hoping that someone more experienced would be able to help me. I am trying something very simple--reading in a tiff file created by Imagetool (under Openwin 3.0, Solaris 2.2), and writing it out into another tiff file (just to test that I am able to read and write tiff files...). I am using Sam's libtiff functions to do so. The file I am reading is a grayscale image, but Imagetool stores it with color map info. After I have read it in my program, and written it out to a new tiff file, and I do a tiffinfo on it, I get:

choma% tiffinfo scaled.tif
scaled.tif: TIFF directory is missing required "Colormap" field.

Of course, I can't display the file using Imagetool.

The question is: how do I read the colormap field, and write it into the new file (I was able to read all the fields with a single parameter using the TIFFGetField, and was able to write them using TIFFSetField, but couldn't figure out a way to do so with multi-parameter fields)?

From tiffcp.c, for example,

        { uint16 *red, *green, *blue;
          if (TIFFGetField(in, TIFFTAG_COLORMAP, &red, &green, &blue)) {
                CheckAndCorrectColormap(1<<bitspersample, red, green, blue);
                TIFFSetField(out, TIFFTAG_COLORMAP, red, green, blue);
          }
        }

or perhaps I don't understand the question?. Note that TIFF colormap values are 16 bits so be sure to scale the values if you are working with an 8-bit colormap such as used by GIF.

Another (slightly unrelated) question: I was looking for a tool for scaling an image. Has anyone written such a program? Even more interesting would be a program that provides the user with flexibility to scale the x and y axis differently.

On SGI machines there are tools that are a part of the ImageVision product. I've never received a scaler that explicitly works on TIFF images, probably because everyone just converts to pbm and then uses the pbm tools.

I hope I am not abusing this mailing list--that it is indeed meant for pusposes such as these.

It's intended for just these sorts of questions.

Sam