split TIF files

Example requests & Code samples for GdPicture Toolkits.
Post Reply
User avatar
paulo moura
Posts: 4
Joined: Thu Sep 06, 2007 9:12 pm
Location: Brasil
Contact:

split TIF files

Post by paulo moura » Fri Jul 11, 2008 4:30 am

Hi Loic !
How we can split a TIF multipage file in various TIF singlepage files ?
Thank you in advance.
Paulo Moura

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

Re: split TIF files

Post by Loïc » Fri Jul 18, 2008 10:24 am

Hi,

This is a vb sample to split a multipage tiff image into 2 other multipage tiff:

Code: Select all

Dim nMultiPageImageIN As Long
Dim nMultiPageImageOUT As Long
Dim sTiffPathIN As String
Dim sTiffPathOUT As String
Dim nCpt As Long

nMultiPageImageIN = Imaging1.TiffCreateMultiPageFromFile("multipage.tif")

'Her we will save the 3 first pages of the multipage tiff into another multipage tiff
Call Imaging1.TiffSelectPage(nMultiPageImageIN, 1)
nMultiPageImageOUT = Imaging1.TiffCreateMultiPageFromGdPictureImage(nMultiPageImageIN)
For nCpt = 2 To 3
    Call Imaging1.TiffSelectPage(nMultiPageImageIN, nCpt)
    Call Imaging1.TiffAppendPageFromGdPictureImage(nMultiPageImageOUT, nMultiPageImageIN)
Next nCpt
Call Imaging1.TiffSaveMultiPageToFile(nMultiPageImageOUT, "out1.tif")
Imaging1.CloseImage (nMultiPageImageOUT)

'Her we will save all other pages of the multipage tiff into another multipage tiff
Call Imaging1.TiffSelectPage(nMultiPageImageIN, 4)
nMultiPageImageOUT = Imaging1.TiffCreateMultiPageFromGdPictureImage(nMultiPageImageIN)
For nCpt = 5 To Imaging1.TiffGetPageCount(nMultiPageImageIN)
    Call Imaging1.TiffSelectPage(nMultiPageImageIN, nCpt)
    Call Imaging1.TiffAppendPageFromGdPictureImage(nMultiPageImageOUT, nMultiPageImageIN)
Next nCpt
Call Imaging1.TiffSaveMultiPageToFile(nMultiPageImageOUT, "out2.tif")
Imaging1.CloseImage (nMultiPageImageOUT)
Imaging1.CloseImage (nMultiPageImageIN)
Best regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests