How to Split and Read Pages of TIFF image?

Hi All,

How to split TIFF image having multiple pages for reading it through OCR?
Any solution with example XAML would be more useful.

Any help…much appreciated!!

3 Likes

Hello,

I too had a similar problem (to scrap a data from tiff with multiple layers), i tried searching but couldn’t got exactly what i wanted so finally I created a new Activity and now i can able to get array of JPEGs as output by passing TIFF as input.

i reffered below link if you are from .NET background this will surely helps.
[Browse code samples | Microsoft Learn](http://MSDN TIFF TO JPEG)

else you can simply use upload the attached package and use the Tiff to JPEG activity.
MyPackage.1.3.0.nupkg (4.5 KB)

Example XAML is attached just for reference.
Main.xaml (19.1 KB)

Hope this solves yours too. :slight_smile:

6 Likes

Hey @megharajky,

Thanks! I will try this for sure and let you know. :wink:

Thank you so much @megharajky. That works perfectly. Appreciate your help.

1 Like

Hi @megharajky,

I’m trying to use this package. But I’m unable to install it. I’m getting ‘Package Installation Failure’ error. Is there any solution for this?

Kind Regards,
Renju

Updated version
Test.Product1.Activities.0.1.0.nupkg (41.1 KB)

2 Likes

Please use the below vb.net code.

Dim tiffFilePath As String = “inputfilename.tif”
Dim outputDirectory As String = “outputfolderpath”

' Create an image object from the TIFF file
Dim tiffImage As System.Drawing.Image = System.Drawing.Image.FromFile(tiffFilePath)

' Get the frame dimensions of the TIFF image
Dim frameDimensions As New System.Drawing.Imaging.FrameDimension(tiffImage.FrameDimensionsList(0))

' Get the total number of frames (pages) in the TIFF image
Dim frameCount As Integer = tiffImage.GetFrameCount(frameDimensions)

' Loop through each frame (page) and save it as a separate image
For frameIndex As Integer = 0 To frameCount - 1
    tiffImage.SelectActiveFrame(frameDimensions, frameIndex)
    Dim pageImage As New System.Drawing.Bitmap(tiffImage)

    ' Construct the output file path
    Dim outputPath As String = Path.Combine(outputDirectory, $"Page_{frameIndex + 1}.png")

    ' Save the page image as a separate PNG file (you can choose other formats if needed)
    pageImage.Save(outputPath, System.Drawing.Imaging.ImageFormat.Png)

    ' Dispose of the page image to release resources
    pageImage.Dispose()
Next

' Dispose of the TIFF image
tiffImage.Dispose()

You could just use Document Understanding. This is one of the things it’s built to do.