Append to a Multipage Tiff

Feature Requests for GdPicture.NET.
Post Reply
jaswicki
Posts: 17
Joined: Mon Oct 08, 2007 9:56 pm

Append to a Multipage Tiff

Post by jaswicki » Mon Oct 08, 2007 10:07 pm

Is there a way to insert a new scanned page into a multipage TIF at a particular page number rather than to the end, such as adding a cover page to an existing multipage tiff? Or if not is there a way to merge 2 or more Tiffs?


[Update by Loïc Carrère]. See: viewtopic.php?t=395

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Post by Loïc » Wed Oct 10, 2007 4:44 pm

[Update by Loïc Carrère]. Deprecated post. See: viewtopic.php?t=395








Hi,

To write to on an existing multipage tif image you need:

- Extract all the pages into temporary image files.

Code: Select all

Imaging1.CreateImageFromFile sMultiPageTiffPath

nImageID = Imaging1.CreateImageFromFile("inputmultipage.tif")
nPageCount = Imaging1.TiffGetPageCount 
 
For nCpt = 1 To nPageCount 
     Imaging1.TiffSelectPage (nCpt)
     Imaging1.SaveAsTiff (Str(nCpt) & ".tif")
Next nCpt

Imaging1.CloseNativeImage
- Recompose new multi page tif file from the temporary files.

Code: Select all

nImageID = Imaging1.CreateImageFromFile("1.tif")
Imaging1.TiffSaveAsNativeMultiPage ("outputmultipage.tif")
  
For nCpt = 2 To nPageCount 
    nImageID = Imaging1.CreateImageFromFile(str(nCpt) & ".tif")
    Imaging1.TiffAddToNativeMultipage (nImageID)
    Imaging1.CloseImage (nImageID)
next nCpt  

'Here add your new image, ex Imaging1.TiffAddToNativeMultipage (nNewImageID)

Imaging1.TiffCloseNativeMultiPage

However, for the next release I will add a method to merge two tif files.

Best regards,

Loïc Carrère
Last edited by Loïc on Tue Dec 04, 2007 7:30 am, edited 1 time in total.

jaswicki
Posts: 17
Joined: Mon Oct 08, 2007 9:56 pm

Post by jaswicki » Fri Oct 19, 2007 2:19 pm

Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests