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, December 9, 2013 1:59:19 AM(UTC)
Raja.Gopalan

Groups: Registered
Posts: 9


Hi,

I have Annotations as xml file and image. Now, i want combine both and save as a new image file.
How do i perform this.? Provide some code snippets. Reply ASAP.
NOTE: i am working with V18 version.

Thanks in Advance.
 

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 : Monday, December 9, 2013 3:26:56 AM(UTC)

mohamed  
mohamed

Groups: Registered, Tech Support
Posts: 179


If you mean that you need to burn the annotation to the image and then save the resulting image, these features are already included in our HTML5 Annotation demo that is shipped with our toolkit setup.
The demo location is:
[LEADTOOLS ]\Examples\JS\HTML5Demos

Please check the "burnAnnotations" and "saveImage" functions in the "AnnotationsDemo.js" file.
You can find the "AnnotationsDemo.js" file under the following path:
[LEADTOOLS ]\Examples\JS\HTML5Demos\Scripts

If you mean something else, please send me the details of your requirement.
Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#3 Posted : Monday, December 9, 2013 4:12:48 AM(UTC)
Raja.Gopalan

Groups: Registered
Posts: 9


Thanks Mohamed.
I m trying this following sample. But in this case, i cant load '.xml' annotation file. only I can load '.ann' file.
I need to burn Html5demo resulted xml annotation file into an image using C#. How to do this.?
...
// Create an instance of the Annotation IO engine
AnnCodecs _annCodecs = new AnnCodecs();
//AnnCodecsFormat.Xml;

// Create an instance of the ann container for the annotations to reside in
AnnContainer annotationsContainer = new AnnContainer();

// Load a sample file
RasterImage srcImage = codecs.Load(srcImageFileName);

// Size Object
annotationsContainer.Bounds = new AnnRectangle(0, 0, srcImage.Height, srcImage.Width);
// Load the annotations
_annCodecs.Load(srcAnnFileName, annotationsContainer, 1);


// Loop all pages in the image file
for (int i = 1; i <= srcImage.PageCount; i++)
{
srcImage.Page = i;
// Paint the annotations directly to the image
//Method #1
System.Drawing.Graphics gdiPlusGraphics = Leadtools.Drawing.RasterImagePainter.CreateGraphics(srcImage).Graphics;
annotationsContainer.Draw(gdiPlusGraphics);
gdiPlusGraphics.Dispose();

// Save the modified file out
int bitsPerPixel = 0; // srcImage's bit depth
codecs.Save(srcImage, targetFileName, RasterImageFormat.Jpeg, bitsPerPixel, i, i, 1, CodecsSavePageMode.Append);
gdiPlusGraphics.Dispose();
}
// Notify user
MessageBox.Show("Test complete", "All done", MessageBoxButtons.OK, MessageBoxIcon.Information);

// Clean up
//annotationsContainer.Dispose();
srcImage.Dispose();


 
#4 Posted : Monday, December 9, 2013 11:36:30 PM(UTC)

mohamed  
mohamed

Groups: Registered, Tech Support
Posts: 179


So you're trying to burn the annotations using C# code, not HTML5.

I tested this issue using both HTML5 Annotation demo and the C#.NET Annotations demo and I was able to do the following:
1. Create an HTML5 annotation file (.XML).
2. Save the Image used for creation the annotation file in HTML5.
3. Rename the resulting XML annotation file to be the same name as the image but keep the .XML extension.
4. Run the .NET Annotations demo.
5. Load the saved Image and notice that the resulting HTML5 annotation (.XML) file gets loaded.
6. From the "Annotations" menu item click "Realize".
7. From the "File" menu item click "Save As..." menu item.
If this works at your side this way, check the code for each step in our demo and try to implement it in your code.
If it doesn't work, make sure to download and use the latest version of LEADTOOLS 18 from our website.
Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#5 Posted : Monday, December 16, 2013 8:09:48 PM(UTC)
Raja.Gopalan

Groups: Registered
Posts: 9


Thanks Mohamed. Its working.
 
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-2019, Yet Another Forum.NET
This page was generated in 0.141 seconds.