Set image quality

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Annotation MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-annotation -- dnx GroupDocs.Annotation.Mcp --yes
Folders, licensing and more →

On this page

GroupDocs.Annotation v22.4 and later allows you to set the quality of an image added to a document. To do this, specify the imageQuality parameter of the AddImageToDocument method.

The parameter value is from 1 to 100. 1 means the lowest resolution, and 100 means the highest.

The following code snippet shows how to set the image quality:

using (Annotator annotator = new Annotator("input.pdf-file")) // specify the path to the input PDF file
{
	string dataDir = "input.pdf"; // specify the path to the input PDF file
    string data = "image.jpg"; // the path to the JPG file
    int pageNumber = 1; // set the page where the image will be inserted
    int imageQuality = 10; // set image quality from 1 to 100
    annotator.Document.AddImageToDocument(dataDir, data, pageNumber, imageQuality);
}

On this page