AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

1994.03.08 22:08 "Re: NeXT to standard X11 Image/Pixmap (really bug in TIFFWriteDirectory)", by Sam Leffler

    On Mon, 7 Mar 1994, Sam Leffler wrote:

    > If you told me how you were trying to do this I might be able to
    > help. I don't recall if tiffcp extracts alpha or not. If not it
    > would seem to be logic place to start.
    >
    > Sam
    >

    Both tiffcp and tiffsplit strip out the Alpha values. I'm adding
    a uuencoded sample NeXT tiff to show what I mean...

    I'm running tiffsplit on the file, to seperate out the black and white
    and color images... then converting the color image to be displayed, but
    I need the alpha values to be preserved...

Your problem turns out to be a bug in the directory writing code; the alpha *data* are actually present in the file. Apply this patch to tif_dirwrite.c to insure the ExtraSamples tag is written.

Sam

*** 1.31        1993/08/26 14:24:07
--- tif_dirwrite.c      1994/03/08 22:03:48
***************
*** 163,169 ****
         * Write out ExtraSamples tag only if
         * extra samples are present in the data.
         */
!       if (FieldSet(fields, FIELD_EXTRASAMPLES) && td->td_extrasamples) {
                ResetFieldBit(fields, FIELD_EXTRASAMPLES);
                nfields--;
                dirsize -= sizeof (TIFFDirEntry);
--- 163,169 ----
         * Write out ExtraSamples tag only if
         * extra samples are present in the data.
         */
!       if (FieldSet(fields, FIELD_EXTRASAMPLES) && td->td_extrasamples == 0) {
                ResetFieldBit(fields, FIELD_EXTRASAMPLES);
                nfields--;
                dirsize -= sizeof (TIFFDirEntry);