This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, January 17, 2008 7:47:18 AM(UTC)
Groups: Registered
Posts: 4
I'm using V15 and I want to load an existing annotation, apply the annotation to an image, and then save as a new image, say a Jpeg, with the annotations now part of the Jpeg. Can this be done?
Thanks.
#2
Posted
:
Thursday, January 17, 2008 7:59:40 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
There are examples of this in the help files, you will be interested in the sections about realizing annotations. Just open the help file for the section you are using and search for realize.
#3
Posted
:
Thursday, January 17, 2008 9:16:02 AM(UTC)
Groups: Registered
Posts: 4
Thanks Boyd. Appreciate the hint about using "Realize." But I've been through the help, now searching realize, but I only see stuff on redactions and automations.
Once you've got an annotation into a container, how exactly does the container get related to an image? I've seen a comment in some code about this, but then I see no code that does it.
I'm not being lazy, but could you indulge me and give me a simple synopsis of what objects and methods I should be looking at to take an existing annotation already in a container (assuming this was the correct way to go?) and associate with an image to save?
Thanks.
Tom
#4
Posted
:
Thursday, January 17, 2008 10:01:23 AM(UTC)
Groups: Registered
Posts: 4
OK, I (partially) see. The AnnAutomation is the key--I had the wrong idea about that--for some reason thought it was only about other media.
Tom
#5
Posted
:
Friday, January 18, 2008 9:01:21 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
The below code is the minimum to burn an annotation in to an image without displaying an user interface to the user. Is this what you are looking for?
RasterImageViewer viewer = new RasterImageViewer();
viewer.Image = codecs.Load(filename);
AnnAutomationManager manager = new AnnAutomationManager();
AnnAutomation automation = new AnnAutomation(manager, viewer);
AnnTextObject obj = new AnnTextObject();
obj.Bounds = new AnnRectangle(0, 0, 50, 50);
obj.Brush = new AnnSolidBrush(Color.Red);
obj.Font = new AnnFont(FontFamily.GenericSansSerif, new AnnLength(12), FontStyle.Regular);
obj.Pen = new AnnPen(Color.Red, new AnnLength(5));
obj.Text = "i am text";
obj.TextColor = Color.Black;
automation.Container.Objects.Add(obj);
automation.Realize();
codecs.Save(viewer.Image, "c:\\test.tif", RasterImageFormat.Tif, 0);
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.