[comp.graphics] TIFF & ImageMagick bug

kjartan@zig.inria.fr (Kjartan Emilson) (11/18/90)

I guess that the following bugs are well known, and I am just stupid enough
to get myself broken versions of these packages, but in principle these
should have been from reliable sources, so I report them anyway, in case
somebody has had the same p a i n trying to trace them out  >:-(

TIFF Bug:  In the file tif_open.c, line 133 and line 196 we have:

>                       if (!TIFFDefaultDirectory(tif))
>                               goto bad;

But TIFFDefaultDirectory is not defined to return anything.  On my Sparc
it returns always 0 and to bad I went.  Fix it by taking away the condition,
or letting TIFFDefaultDirectory return TRUE.

ImageMagick Bug:  In the filter MIFFtoTIFF in the file MIFFtoTIFF.c
                  at line 248, we have:

>TIFFSetField(file,TIFFTAG_COLORMAP,c,c+image->colors,c+image->colors*2);

This sets the COLORMAP field of the TIFF file, but the actual colormap
entries are not defined until in the next 6 lines, so the TIFF file gets
saved with a colormap with all zeros...  Fix it by moving the above line
down 6 lines, and change 'c' to 'colormap' in the argument list:

>       ..
>       ..
>       for (i=0 ; i < image->colors; i++)
>               *c++=image->colormap[i].blue << 8;
>       TIFFSetField(file,TIFFTAG_COLORMAP,
>            colormap,colormap+image->colors,colormap+image->colors*2);


                Hope this helps,



                                        -Kjartan


-------------------------------------------------------------------------
Kjartan Pierre Emilsson
Institut Non-lineaire de Nice-Sophia-Antipolis
Parc Valrose
Nice
France