jay Bukstein


I have a Windows VB application that views and copies TIF images, some single pages some multiply pages. What I need to do is to for each page in the tif is to break to image file into separte pages,

How can I do that



Re: Splitting Images

jay Bukstein


One other thing I need to add is I need to split the TIF file from 1 multipage to many single page files.





Re: Splitting Images

Riquel Dong ¨C MSFT

Hi Jay,

Based on your post, my understanding of your question is that you need to split the Tif image. Here is the code snippet to split the Tif image file. If you have any further questions, please tell me.

Code Snippet

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim tif As New Bitmap("c:\billy.tiff")

Dim framenumber As Integer = tif.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page)

For x As Integer = 0 To framenumber - 1

tif.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, x)

Dim destimg As New Bitmap(tif.Width, tif.Height)

Dim gr As Graphics = Graphics.FromImage(destimg)

gr.DrawImage(tif, 0, 0)

destimg.Save("d:\temp\" + CStr(x + 1) + ".tif", System.Drawing.Imaging.ImageFormat.Tiff)

gr.Dispose()

destimg.Dispose()

Next

End Sub

Best regards,

Riquel.