Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split a Multipage TIFF File 2

Status
Not open for further replies.

crystalkiwibruce

Programmer
Feb 16, 2011
104
NZ
I know there are some utilities out there to do this. I'd like to take a multi page TIFF File and split it into seperate images.

If the utilities can do it, how can I do it in my code? I'm happy to use VB6 or Dot Net, if needed.


Bruce Ferguson
 
It's a lot simpler than you might think. Here's an example:
Code:
[blue][green]' Add a reference to Microsoft Windows Image Aquisition library[/green]
Private Sub getimagesfromtiff()
    Dim Img As ImageFile
    Dim myPage As ImageFile
    Dim v As Vector
    Dim lp As Long
    
    Set Img = New ImageFile
    
    Img.LoadFile "D:\temp\example.tif"
    
    For lp = 1 To Img.FrameCount
        Img.ActiveFrame = lp
        Set v = Img.ARGBData
        Set myPage = v.ImageFile(Img.Width, Img.Height)
        myPage.SaveFile "d:\temp\example" & lp & ".bmp"
    Next
End Sub[/blue]
 
Wow!

That might come in handy occasionally.

Nice piece of code, strongm!
[thumbsup2]

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top