Tutorial: Draw and Edit Annotations with LEADTOOLS .NET Image SDK

Whatever your image processing needs are, LEADTOOLS has a world-leading SDK to do all the heavy lifting. In previous posts we’ve discussed viewing images, saving images, combining images into a single file, and splitting a file into multiple images. LEADTOOLS also makes it possible to draw and edit annotations and markup objects on images.

In today’s world full of digital collaboration and image sharing, comprehensive annotation support is critical. Throughout the day people and organizations use various types of annotations to call attention to specific aspects of an image or document as well as to enhance user experience, productivity, and security. The LEADTOOLS Annotations libraries support a robust collection of markup objects and tools including highlighting, drawing figures, adding notes, taking measurements, redacting or underlining text, and much more.

The code below will get you started or you can always check out our full tutorial on drawing annotations. We also have a walk-through on how to create custom annotations for your documents or images.

private void Form1_Load(object sender, EventArgs e)
// Initialize Image Viewer object
viewer = new ImageViewer();
viewer.Dock = DockStyle.Fill;

// Initialize Automation Control for Image Viewer
automationControl = new ImageViewerAutomationControl();
automationControl.ImageViewer = viewer;

// Initialize a new RasterCodecs object
RasterCodecs codecs = new RasterCodecs();

// Load the main image into the viewer
viewer.Image = codecs.Load(@"C:\LEADTOOLS21\Resources\Images\ocr1.tif");

// Initialize the Interactive Mode for the Image Viewer
AutomationInteractiveMode automationInteractiveMode = new AutomationInteractiveMode();
automationInteractiveMode.AutomationControl = automationControl;

// Add the Interactive Mode to the Image Viewer

if (viewer.Image != null)
// Create and set up the Automation Manager
annAutomationManager = new AnnAutomationManager();
annAutomationManager.RestrictDesigners = true;

// Instruct the Manager to create all the default Automation objects.

// Initialize the Manager Helper and create the Toolbar
// Add the Toolbar and the Image Viewer to the Controls
AutomationManagerHelper managerHelper = new AutomationManagerHelper(annAutomationManager);

// Set up the Automation (it will create the Container as well)
automation = new AnnAutomation(annAutomationManager, automationControl);
// Set this Automation as the active one
automation.Active = true;

// Set the size of the Container to the size of the Image Viewer
automation.Container.Size =

See For Yourself!

To test this for yourself, make sure to download the latest LEADTOOLS SDK evaluation if you have not already. This trial is good for 60 days and comes with unlimited chat and email support.

Free Technical Support

Need help getting this sample up and going? Contact our support team for free technical support! For pricing or licensing questions, you can contact our sales team (sales@leadtools.com) or call us at 704-332-5532.

This entry was posted in .net, Annotations, Document Converter and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *