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 : Friday, June 5, 2009 6:18:07 AM(UTC)

Kiima  
Kiima

Groups: Registered
Posts: 25


I need a way to add/burn annotations below or above the image, so that I don't block any data on the image. How do I resize/shrink the image just enough to accomodate the annotation, almost like a header or footer.


LeadTools v16, WinForms Development with VB.NET

Stuck,
   -Kiima
 

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 : Sunday, June 7, 2009 4:20:53 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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

If you mean that you want to burn the Annotation objects above the original image without affecting the image data, you need to create a new large image that contains the original image data with the header and footer. And then you can draw and burn the annotation objects on the header or footer of the new large image.
You can create the new large image by using the following code:
+-----------------+
RasterCodecs.Startup();
RasterCodecs codecs = new RasterCodecs();

RasterImage OriginalImage = codecs.Load(@"c:\Sunset.jpg");

NewImage = new RasterImage(RasterMemoryFlags.Conventional,
             OriginalImage.Width + 100,
             OriginalImage.Height + 100,
             24,
             RasterByteOrder.Bgr,
             RasterViewPerspective.TopLeft,
             null,
             IntPtr.Zero,
             0);

FillCommand Fill = new FillCommand();
Fill.Color = new RasterColor(Color.White);
Fill.Run(NewImage);

CombineCommand Combine = new CombineCommand();
Combine.DestinationRectangle = new Rectangle(50, 50, OriginalImage.Width, OriginalImage.Height);
Combine.SourcePoint = new Point(0, 0);
Combine.SourceImage = OriginalImage;
Combine.Run(NewImage);

//Now, you can draw the Annotation objects below or above the original image
+-----------------+

If you mean something else, please provide me with more details about your requirements.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Wednesday, June 10, 2009 5:23:47 AM(UTC)

Kiima  
Kiima

Groups: Registered
Posts: 25


OK, that makes sense.

How does it affect any existing annotations/redactions on the original image? Will they be located in the wrong position or should I burn them first, then burn the footers and headers.
 
#4 Posted : Wednesday, June 10, 2009 6:11:06 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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

That depends on which image and annotations you mean.
The combine command does not copy any annotation objects. It only affects pixel data. The process can be named 'canvas resizing'.

The new resulting image will have the original image, plus additional pixels at top and bottom. It is up to you to decide what to do with annotations if they existed on the original image. In general, you need to consider the following:
1. The annotation container dimensions should be changed to match the new size.
2. If you copy the objects to the new container, you will need to translate (shift) them down by the amount of increase in header size.

I don't know what your exact requirements are, so you may or may not need to copy the objects or realize them. If you need to burn everything, it's probably easier to burn the original image objects first, then do the 'canvas resizing' and burn the header/footer objects.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Thursday, June 11, 2009 6:10:25 AM(UTC)

Kiima  
Kiima

Groups: Registered
Posts: 25


I'm using multi-page TIFs and PDFs. Do I need to do the fill and combine commands for every page? If so, do you have some sample code?
 
#6 Posted : Friday, June 12, 2009 6:19:56 AM(UTC)

Walter  
Walter

Groups: Tech Support
Posts: 367

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

Hello Kiima,

Maen is out of the office for the weekend, so please allow me to assist here.

Yes, you will need to cycle through each page and run the fill and combine commands. You'll need to update the Page property on both images before running the commands again. Some sample code should be something like this:

/* Set up the command here */

// Make sure you start at the beginning
OriginalImage.Page = 1;
NewImage.Page = 1;

for(int index = 1; index <= OriginalImage.PageCount; index++)
{
Command.Run(NewImage);


// Make sure you don't try to assign a page that doesn't exist
if(OriginalImage.Page < OriginalImage.PageCount)
OriginalImage.Page += 1;

if(NewImage.Page < NewImage.PageCount)
NewImage.Page += 1;
}



I also know of a project that may be helpful to you. The project is designed to illustrate how to keep track of annotations for multi-page images. You can find the sample here:
http://support.leadtools.com/SupportPortal/cs/forums/9513/ShowPost.aspx
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
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.090 seconds.