DEV Community

Shahzad Ashraf
Shahzad Ashraf

Posted on

Boost Your Image Annotation Workflow: Insert Ellipse Annotations into JPGs

Altering images with ellipse annotations is a crucial aspect of workflows in image processing. When creating a document management system, a collaborative annotation tool, or dynamically marking up JPG images, the GroupDocs.Annotation Cloud .NET SDK offers an effective and scalable solution. By making just a few API calls, you can easily apply ellipse annotations to JPG images within .NET—eliminating the need for complicated image processing!

This cloud-based annotation API allows for customization of annotations, precise positioning control, adjustment of opacity levels, and accurate markup directly in your .NET applications. This makes it the perfect solution for platforms focused on document collaboration, image processing applications, and tools aimed at workflow automation. Additionally, since it operates in the cloud, you don’t have to deal with issues related to storage, rendering, or compatibility.

Begin enhancing your images by discovering how to implement ellipse annotations in JPG using .NET with minimal code and maximum adaptability. Are you prepared to elevate your application's annotation features? Check out this comprehensive tutorial and optimize your image annotation workflows today!

You can experience this feature for yourself by looking at the following C# code example:

using GroupDocs.Annotation.Cloud.Sdk;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;

class Program
{
    static void Main(string[] args)
    {
        // Initialize the API configuration with your credentials
        string MyClientId = "your-client-id";
        string MyClientSecret = "your-client-secret";
        var configuration = new Configuration(MyClientId, MyClientSecret);

        // Instantiate an AnnotateApi instance to apply the annotation
        var annotationApi = new AnnotateApi(configuration);

        // Set the input JPG image file details
        var fileInfo = new GroupDocs.Annotation.Cloud.Sdk.Model.FileInfo
        {
            // Input file path in cloud storage
            FilePath = "SampleFiles/source.jpg"
        };

        // Create Ellipse annotation
        var annotation = new AnnotationInfo
        {
            // Set annotation properties
            AnnotationPosition = new Point { X = 2, Y = 2 },
            Box = new Rectangle { X = 150, Y = 150, Width = 150, Height = 150 },
            PenStyle = AnnotationInfo.PenStyleEnum.Solid,
            BackgroundColor = 50630,
            PenColor = 50630,
            PenWidth = 4,
            Type = AnnotationInfo.TypeEnum.Ellipse, 
            Text = ".NET REST Annotation API", 
            Opacity = 0.7,
            PageNumber = 0, // Page index (0-based)
            CreatorName = "Cloud API", 
            CreatedOn = DateTime.Now,
        };

        // Set annotation options, including the output file path
        var options = new AnnotateOptions
        {
            FileInfo = fileInfo,
            Annotations = new List<AnnotationInfo> { annotation },
            OutputPath = "annotation/output.jpg"
        };

        // Add the ellipse annotation to the JPG image file
        var result = annotationApi.Annotate(new AnnotateRequest(options));

    }
}
Enter fullscreen mode Exit fullscreen mode

AWS Q Developer image

Your AI Code Assistant

Ask anything about your entire project, code and get answers and even architecture diagrams. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Start free in your IDE

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

DEV is better (more customized, reading settings like dark mode etc) when you're signed in!

Okay