2004.12.28 02:41 "[Tiff] how to insert or replace a image in multi-page tiff file using libtiff", by Kelvin Zhong

2004.12.30 00:56 "[Tiff] Re: how to insert or replace a image in multi-page tiff file using libtiff", by Kelvin Zhong

I have tried to modify the libtiff ,and have complished the insert at the page number P. I just adjust the nextdir offset of the image at position P and the new next diroffset of the new IFD point to the image at position P+1.

my step:
   Open the tiff file with mode "a"(append)
   Write the insert page.(so it append to the file.and became the last page)
   Close the tiff file.
   Open the tiff file with mode "a"(append)
   Change the directory link chain.
   Close the tiff file.
   (for example, before change the directory link chain, the IFDs link is
    [tif->tif_header.tiff_diroff]->A->B->C->D->E.so A is the first page,and E
   is the last page(and it was intented to insert to page 3,before page C).
   but before change the directory link it was the last page.
   so i opened the tiff file again to change the directory link to
   [tif->tif_header.tiff_diroff]->A->B->E->C->D)
   be sure you end the link by modify the page D's IFD->nextdir=0;

but i still have noidea to do replace the image at pagenumber P.

would any one help me?

EMAIL:Kingore@126.com