Add Annotation Rectangle on a JPG image

Discussions about annotation support.
Post Reply
guidoste
Posts: 7
Joined: Thu May 14, 2009 2:56 pm

Add Annotation Rectangle on a JPG image

Post by guidoste » Tue Jan 10, 2012 12:28 pm

Is there a sample available to add an Annotation Rectangle on a JPG image by code?

GS

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

Re: Add Annotation Rectangle on a JPG image

Post by Loïc » Tue Jan 10, 2012 7:59 pm

Hi,

Here a sample. let me know if you need more info.

Code: Select all

        Dim oGdPictureImaging As New GdPictureImaging
        Dim oAnnotationManager As New AnnotationManager

        Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("c:\test.jpg")
        oAnnotationManager.InitFromGdPictureImage(ImageID)
        Dim rectAnnot As AnnotationRectangle = oAnnotationManager.AddRectangleAnnot(Color.Red, Color.Transparent, 1, 1, 3, 3)

        'todo: change annot property here, if any
        '
        'oAnnotationManager.BurnAnnotationsToPage(True) 'Uncomment to burn annots to page
        oAnnotationManager.Close()
        oGdPictureImaging.SaveAsJPEG(ImageID, "c:\testout.jpg")
        oGdPictureImaging.ReleaseGdPictureImage(ImageID)

guidoste
Posts: 7
Joined: Thu May 14, 2009 2:56 pm

Re: Add Annotation Rectangle on a JPG image

Post by guidoste » Wed Jan 11, 2012 3:55 pm

Thank You, I'm going to try

guidoste
Posts: 7
Joined: Thu May 14, 2009 2:56 pm

Re: Add Annotation Rectangle on a JPG image

Post by guidoste » Wed Jan 11, 2012 6:07 pm

I did mis something when I want to display it on the screen see: "GdViewer1...." I got the image without the annotation

Code: Select all

        
        Dim oGdPictureImaging As New GdPictureImaging
        Dim oAnnotationManager As New AnnotationManager

        Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("c:\test.jpg")
        oAnnotationManager.InitFromGdPictureImage(ImageID)
        Dim rectAnnot As AnnotationRectangle = oAnnotationManager.AddRectangleAnnot(Color.Red, Color.Transparent, 1, 1, 3, 3)
   
        GdViewer1.DisplayFromGdPictureImage(ImageId)  

        'todo: change annot property here, if any
        '
        'oAnnotationManager.BurnAnnotationsToPage(True) 'Uncomment to burn annots to page
        oAnnotationManager.Close()
        oGdPictureImaging.SaveAsJPEG(ImageID, "c:\testout.jpg")
        oGdPictureImaging.ReleaseGdPictureImage(ImageID)

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

Re: Add Annotation Rectangle on a JPG image

Post by Loïc » Wed Jan 11, 2012 6:09 pm

You have to call

Code: Select all

oAnnotationManager.Close();/* or oAnnotationManager.SaveAnnotationsToPage();*/ 
Before

Code: Select all

GdViewer1.DisplayFromGdPictureImage();
Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 2 guests