MultiPage Tiff to MultiPage Tiff cause change resolution

Example requests & Code samples for GdPicture Toolkits.
Post Reply
fierikit
Posts: 20
Joined: Mon Nov 05, 2007 7:03 pm
Location: Italy
Contact:

MultiPage Tiff to MultiPage Tiff cause change resolution

Post by fierikit » Fri Jun 05, 2009 7:11 pm

I'm so stupid, sure
I've found a lot of examples for Multipage Tiff but no one is what i need:

I've a multipage Tif and i need to create another Tif (with another name)
the differenze from source to destination is just in a resolution changing
but I fail! cause the destination is only with first page
i try a lot of changhes but....

here is the worng code:

Code: Select all

dim OldFullFileName As String, ByVal NewFullFileName As String
dim ByVal bChangeResolution As Boolean
dim nNativeImageHandle as long
Dim nPages As Integer     
Dim TotPages As Integer
Dim retValue As Long

With gdImage
    .SetLicenseNumber (GDPICTURELICENSE)
        Call .TiffCreateMultiPageFromFile(OldFullFileName)
        nNativeImageHandle = .GetNativeImage()
        TotPages = .TiffGetPageCount(nNativeImageHandle)
        For nPages = 1 To TotPages
            Call .TiffSelectPage(nNativeImageHandle, nPages)
            nNativeImageHandle = .GetNativeImage()
            If bChangeResolution Then 'Changing resolution
            If nPages = 1 Then
                Call .TiffSaveAsNativeMultiPage(NewFullFileName)
            Else
                .TiffAddToNativeMultiPage (nNativeImageHandle)
            End If
            .CloseImage (nNativeImageHandle)
        Next
        .TiffCloseNativeMultiPage
end with

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

Re: MultiPage Tiff to MultiPage Tiff cause change resolution

Post by Loïc » Mon Jun 08, 2009 1:47 pm

Hi,

Here a good way to do that:

Code: Select all

With Imaging1
    .SetLicenseNumber ("LICENSE_KEY")
     nNativeImageHandle = .TiffCreateMultiPageFromFile("")
     For nPages = 1 To .TiffGetPageCount(nNativeImageHandle)
         Call .TiffSelectPage(nNativeImageHandle, nPages)
         .SetVerticalResolution (200)
         .SetHorizontalResolution (200)
     Next nPages
     Call .TiffSaveMultiPageToFile(nNativeImageHandle, "c:\test.tif", CompressionCCITT4)
     .CloseImage (nNativeImageHandle)
End With

Kind regards,

Loïc

fierikit
Posts: 20
Joined: Mon Nov 05, 2007 7:03 pm
Location: Italy
Contact:

Re: MultiPage Tiff to MultiPage Tiff cause change resolution

Post by fierikit » Tue Jun 09, 2009 3:56 pm

Sorry but this line open the 'Open file' Dialog ... so i cannot use in the code.
nNativeImageHandle = .TiffCreateMultiPageFromFile("")
also i connot understand where is the referenxe of the original image file

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

Re: MultiPage Tiff to MultiPage Tiff cause change resolution

Post by Loïc » Tue Jun 09, 2009 4:52 pm

Just replace "" by your tiff path.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest