2007.01.19 21:54 "[Tiff] Orientations with rhs are creating problems in tiffcp", by Richard Nolde

Tiffcp contains the code snippet below for dealing with the orientation tag. It appears that any image that has an top or bottom right-hand side orientation is changed to the corresponding left-hand side when it is written out. However, the data is not read in and rewritten with the strip data reversed. This is causing problems for some old images I have run across, producing a mirror effect on the data. I wrote mirroring code in tiffcrop and this could be called to mirror the data, there by correcting the problem. Has anyone else seen this issue? This is particularly nasty for Group3/4 compressed images, but my tiffcrop utility can handle them so I think that this would work here too.

Is this worth pursueing or will it break other codecs or parts of the code. I haven't tried a patch yet, but it would appear to me that you should not change he orientation unless you also reverse the data that it describes.

Yes?

Richard Nolde

    TIFFGetFieldDefaulted(in, TIFFTAG_ORIENTATION, &orientation);
    switch (orientation) {
        case ORIENTATION_BOTRIGHT:
        case ORIENTATION_RIGHTBOT: /* XXX */
            TIFFWarning(TIFFFileName(in), "using bottom-left orientation");
            orientation = ORIENTATION_BOTLEFT;
        /* fall thru... */
        case ORIENTATION_LEFTBOT: /* XXX */
        case ORIENTATION_BOTLEFT:
            break;
        case ORIENTATION_TOPRIGHT:
        case ORIENTATION_RIGHTTOP: /* XXX */
        default:
            TIFFWarning(TIFFFileName(in), "using top-left orientation");
            orientation = ORIENTATION_TOPLEFT;
        /* fall thru... */
        case ORIENTATION_LEFTTOP: /* XXX */
        case ORIENTATION_TOPLEFT:
            break;
    }
    TIFFSetField(out, TIFFTAG_ORIENTATION, orientation);