We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose OMR Deskew & Save Formats


I have the following code that worked in Aspose.OCR for .NET (Product Version: 2016.06.10) after updating to the latest version (22.8.0) it no longer works. The purpose of the function is to deskew an image. I’ve tried a few different things refactoring the code but have not been able to figure it out. How can we deskew images and save in the same formats as shown in the code below?

   Private Shared Function AutoDeskewImage(ByVal ExistingImage As Image, ByVal Save As Boean) As Image 
        Dim engine As OmrEngine = Nothing
        Dim omrImg As OmrImage = Nothing
        Dim ms As MemoryStream = Nothing
        Dim degree As Integer

            'Load omr image from aspose image
            ms = New MemoryStream()
            ms.Seek(0, System.IO.SeekOrigin.Begin)
            omrImg = Aspose.OMR.OmrImage.Load(ms)

            'Use empty template or load any existing template
            engine = New OmrEngine(New OmrTemplate())

            'Get skew degree of the image
            degree = engine.GetSkewDegree(omrImg)

            'Rotate image to correct skew
            engine.RotateImage(omrImg, degree)

            'copies the omr image to existing image with tiff format
            omrImg.AsBitmap().Save(ms, System.Drawing.Imaging.ImageFormat.Tiff)
            ms.Seek(0, System.IO.SeekOrigin.Begin)
            ExistingImage = ImageCtm.Load(ms)

            If Save Then
                Image = ExistingImage
            End If

            Return ExistingImage
        Catch ex As System.Exception
            Throw ex
            If ms IsNot Nothing Then
                ms = Nothing
            End If
        End Try
    End Function


An investigation is required at our end for the feature your shared. Therefore, a ticket as OMRNET-664 has been logged in our issue tracking system for the sake. We will look into its details and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.