Image rotation

Discussions about image processing and document imaging.
Post Reply
DIZ
Posts: 6
Joined: Wed Jul 25, 2012 8:04 pm

Image rotation

Post by DIZ » Fri Jul 27, 2012 8:01 pm

Any help is appreciated!!!

I would like to rotate an image. I create a function (see it bellow) that add an image into the PDF file. However I can't find how to rotate it.

Code: Select all

 Private Function AddStampToPdfFile(ByVal iPage As Integer, ByVal pImage As Image, ByVal stmpLocation As Point, Optional ByVal Opacity As Integer = 100) As GdPicture9.GdPictureStatus

        Dim bm As Bitmap = New Bitmap(pImage)
        Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromBitmap(bm)
        If ImageID <> 0 Then
            oGdPicturePDF.SelectPage(iPage)
            Dim Ps As Integer = oGdPicturePDF.PrintGetPaperSize
            Dim pW = oGdPicturePDF.GetPageWidth

            Dim X As Integer = pW - stmpLocation.X - bm.Width
            Dim sLocX = pW - bm.Width - X
            Dim image_res_name As String = oGdPicturePDF.AddImageFromGdPictureImage(ImageID, False, False)
            oGdPictureImaging.ReleaseGdPictureImage(ImageID)
            oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopRight)
            oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitPoint)
            If Opacity > 0 And Opacity < 100 Then
                oGdPicturePDF.SetFillAlpha(Opacity)
            End If
            Return oGdPicturePDF.DrawImage(image_res_name, sLocX, stmpLocation.Y, bm.Width, bm.Height)
        End If
    End Function

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Image rotation

Post by Loïc » Fri Jul 27, 2012 11:41 pm

Hello,

That's simple. Just call the Rotate() method of the GdPictureImaging class.

Code: Select all

Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromBitmap(bm)
oGdPictureImaging.Rotate(ImageID, RotateFlipType.Rotate90FlipNone)
Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest