How to Split multipage image into single page image

This code is used to split the multipage Tiff image into single single image using
First imports system.drawing.imaging
for example: the tif file path is: "C:\test.tif"
You can pass the file path in below function

Imports system.drawing.imaging

Private Sub SplitImages(ByVal files As String)
'Dim FileSubString As String = System.IO.Path.GetFileNameWithoutExtension(files)
Dim pagecount, ImagePageCount As Integer
Dim oimage As System.Drawing.Image = Nothing
Dim fImage As Bitmap = Nothing
Dim pageLoad As Boolean = False
Dim docPath As String = "C:\"
fImage = New Bitmap(files, False)
oimage = fImage
pagecount = oimage.GetFrameCount(FrameDimension.Page)
pageLoad = True
Catch ex As Exception
pageLoad = False
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
If pageLoad = True Then
If pagecount <> 0 Then
For ImagePageCount = 0 To pagecount - 1
Dim strScanKey As String = System.Guid.NewGuid.ToString
oimage.SelectActiveFrame(FrameDimension.Page, ImagePageCount)
Dim img1 As Drawing.Bitmap = CType(oimage.Clone, Drawing.Bitmap)
Dim documentPath As String = docPath & strScanKey & ".Tiff"
End If
End If
End Sub


Author: Satrajit Bari28 Apr 2010 Member Level: Bronze   Points : 0

Very nice and simple to use.... thanks

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: