Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, February 5, 2007 3:46:34 PM(UTC)
j3nsen888

Groups: Registered
Posts: 4


Is there a way to programatically add annonations to an image without loading the image in the raster viewer and having to realize it? What I am trying to do is bates stamp many images and I don't need to see these images loaded. I just want it to run in the background.

Where can I find sample code to do this? All the code I am able to find actually loads the image in a viewer and provides the user with an annoations menu. I want to programatically annotate images and burn the annotation to the file.

Thanks!

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, February 6, 2007 3:01:09 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

Hello,

You should be able to draw and burn Annotation objects on the image without loading it on a Viewer.
The details depends on the programming interface that you use.
For example, if you are using leadtools .Net v14.5 programming interface, you can do this by using the following code:
+---------------------------+
Dim RasImage As IRasterImage
Dim cod As New RasterCodecs

RasterCodecs.CodecsPath = "D:\Program Files\LEAD Technologies, Inc\LEADTOOLS 14.5\Redist\Dotnet\v11"
RasImage = cod.Load("c:\1.bmp")

Dim stamp As AnnStampObject = New AnnStampObject
Dim pic As New AnnPicture(Image.FromFile("c:\1.jpg"))

pic.TransparentMode = AnnPictureTransparentMode.None
pic.TransparentColor = Color.Black
stamp.Picture = pic
stamp.Bounds = New AnnRectangle(100, 200, 300, 400, AnnUnit.Pixel)
stamp.Draw(RasImage.CreateGdiPlusGraphics().Graphics)
cod.Save(RasImage, "c:\RasImage.jpg", RasterImageFormat.Jpeg, 24)
+---------------------------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Tuesday, February 6, 2007 10:22:10 AM(UTC)
j3nsen888

Groups: Registered
Posts: 4


Thank you Maen. This works well. If I want to put a text annotation instead of a picture I would use

Dim text As AnnTextObject = New AnnTextObject()

instead correct?

Another question - suppose I want to resize the entire raster image to give it a footer region? How would I go about that? I found some code in your help examples online for resizing of an image, but it looks like all the active space is resized. Ideally, I'd like to have the image resized leaving some white space in the bottom of the page for me to annotate so that I don't annotate on the image. Thanks! 

 
#4 Posted : Tuesday, February 6, 2007 11:37:56 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

Hello,

Do you mean that you want to add text on the AnnStamp object instead of the picture?

About resizing the image with footer region (white space in the bottom), you can do this as follows:
- Resize your image to a new width and height using the SizeCommand Class.
- After resizing the image, create a new Raster Image with same width of the resized image, but use a height of the resized image + the height of the footer region that you want.
- Fill the new image with white color using the FillCommand Class.
- Now, combine the new image with the original resized image using the CombineCommand Class.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Wednesday, February 7, 2007 1:48:19 PM(UTC)
j3nsen888

Groups: Registered
Posts: 4


Yes, I meant to add text as the annotation, not an image.

Thanks for the advice on adding a footer region. It makes sense.

 
#6 Posted : Saturday, February 10, 2007 8:55:11 AM(UTC)
wcpierce

Groups: Registered
Posts: 5


Maen,
I recently downloaded the LEADTools Raster Imaging Pro 14.5 SDK because I was interested in evaluating the product for a .Net 1.1 application.  I see C# and VB.Net examples in the SDK, however, they all use the COM interop components and I do not see a Dotnet\v11 folder in the Redist folder.

If there is a better .Net 1.1 wrapper for the 14.5 SDK I would be very interested in evaluating that, rather than struggling with the COM interop components.

Thanks,
-Bill Pierce
 
#7 Posted : Saturday, February 10, 2007 10:42:04 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

j3nsen888,

There is no way to draw an AnnTextObject on the AnnStampObject. If you want to draw a text, you need to use the AnnTextObject as follows:
+--------------------------------+
Dim text As AnnTextObject = New AnnTextObject
text.Text = textString
text.Pen = Nothing
text.Brush = Nothing
text.Font = New AnnFont("Arial", New AnnLength(10, AnnUnit.Point), FontStyle.Regular)
text.EdgeMargin = AnnLength.Empty
text.Alignment = StringAlignment.Center
text.LineAlignment = StringAlignment.Center
text.TextRotate = AnnTextRotate.Rotate0
text.Bounds = New AnnRectangle(100, 200, 400, 600, AnnUnit.Pixel)
container.Objects.Add(text)
+--------------------------------+

Bill,

What is the exact LEADTOOLS v14.5 setup that you downloaded and installed?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#8 Posted : Thursday, May 31, 2007 10:10:45 AM(UTC)

Leonid  
Leonid

Groups: Registered
Posts: 2


How do a text annotation add in position of mouse cursor?

text.Bounds = New AnnRectangle(100, 200, 400, 600, AnnUnit.Pixel)
 
#9 Posted : Saturday, June 2, 2007 11:07:34 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

Hello,

You can do this by creating AnnTextObject Annotation object in the MouseClick event of the RasterImageViewer1 control. The code should be something as follows:
--------------------
Private Sub RasterImageViewer1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles
   Dim text As AnnTextObject = New AnnTextObject()

    If (e.Button = Windows.Forms.MouseButtons.Left) Then        
   text.Pen = New AnnPen(Color.Red, New AnnLength(3))
   text.Text = textString
   text.Brush = Nothing
   text.Font = New AnnFont("Arial", New AnnLength(10, AnnUnit.Point), FontStyle.Regular)
   text.EdgeMargin = AnnLength.Empty
   text.Alignment = StringAlignment.Center
   text.LineAlignment = StringAlignment.Center
   text.TextRotate = AnnTextRotate.Rotate0
   text.Bounds = New AnnRectangle(e.x, e.y, 100, 100,AnnUnit.Pixel)
   automation.container.Objects.Add(text)
    End If
End Sub
--------------------

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.319 seconds.