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



Last Go to last post Unread Go to first unread post
#1 Posted : Sunday, December 5, 2010 3:19:39 PM(UTC)

Groups: Registered
Posts: 3


I am using v14.5 and need to draw annotations onto an image and then save it to a .jpeg.

I am using GDI+ to do this, and although the technique does work, we are frequently getting GDI+ errors. I am using the CloneCommand, as described in another post, to try to force creation of a managed memory, non-tiled image, but the clone command often fails, with 'invalid parameter', which I assume means there was not enough memory available.

I am already scaling the images down in size, but if I scale them down anymore, we will lose too much quality.

My question is: is there another way to do this without using GDI+, to avoid the need for an image in managed memory. Other posts talk about using AnnAutomated.Realize(), but when I try that my annotations come out either solid black, or not visible, even after using the color conversion command. And, I do not know if AnnAutomation is using GDI+ and thus I might have the same problems anyway.

I tried this with the latest 14.5 patches.

Any help is appreciated.

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 6, 2010 5:11:17 AM(UTC)

Adam Boulad  

Groups: Guests
Posts: 3,034

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

I assume you're getting the memory errors mostly when the image size is large, is this correct? If yes, do you also need the annotations to be large and cover most of the image? If not, you can realize a copy of the annotation object on a smaller temporary image filled with a neutral background color (any color that's not part of the annotations themselves), and then combine the temp image with the original image while excluding the background color.
The main functions you'll need are:
FillCommand Class
RasterImage.AddColorToRegion Method
CombineCommand Class

About AnnAutomation.Realize(), it should work and produce correct results if the image is 24-bit color. If you still can't get it to work, open a new forum thread and post more details about the problem, including how you're using it exactly and preferably with attaching a sample image.

#3 Posted : Monday, December 6, 2010 3:32:54 PM(UTC)

Groups: Registered
Posts: 3

Hi Adam,

The errors are mostly occuring on very large images. The annotations can also be large and cover any part of the image, so the combine command technique will probably not work for us.

I got the AnnAutomation.Realize method to work correctly on smaller images. My problem was that I was not running the ColorResolutionCommand on the image first to convert to 24 bit color. Once I did that, it worked great for smaller images. Unfortunately on larger images, it throws an exception: "Value cannot be null.
Parameter name: hdc".

I would like to try splitting the images into pieces and drawing annotations on it one piece at a time, and then assemble all the pieces together. Is there a way to make an AnnContainer draw the portions of its annotations that fall within a rectangle on the image?
#4 Posted : Wednesday, December 8, 2010 5:57:38 AM(UTC)

Adam Boulad  

Groups: Guests
Posts: 3,034

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

You could realize a big annotation on multiple small object as follows:
1. Use a group of smaller bitmaps, each of which is 24-bits per pixel. You can use the RasterImage constructor along with the FillCommand class.
2. For each image, you will need an Annotation container the same size of the image, which will be smaller than the Annotation object(s) to be realized.
3. Create (or copy) the annotation objects in this container. Even if parts of them lie outside the container bounds, this should work.
4. Realize the objects on the bitmap. This requires only the size of the smaller bitmap regardless of how large the Ann objects are. The rest of the objects will be clipped and not realized.
5. Use the CombineFastCommand Class to assemble the pieces into the big image.
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.232 seconds.