This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/csharp/extraction/describe-image-with-local-ai.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Describe images with local AI in C# | Nutrient .NET SDK

Use local AI image description when you need privacy, cost control, or offline operation.

Common use cases include:

  • On-premises accessibility workflows
  • Medical or regulated environments with local-only data handling
  • Secure networks where external APIs are restricted
  • High-volume processing without per-image API fees
  • Offline-capable applications

Nutrient .NET SDK includes a Local provider for zero-configuration local AI. The Local provider runs a model in the SDK process, downloads required model files automatically on first use, and uses GPU acceleration when available.

Download sample

How Nutrient helps

Nutrient .NET SDK handles in-process local model loading, image preparation, and response parsing.

The SDK handles:

  • Zero-configuration Local provider setup
  • Automatic model downloads into the persistent SDK resource cache
  • GPU acceleration when supported by the current system
  • Image encoding and multimodal payload construction
  • Model loading and processing errors

Complete implementation

This example generates image descriptions using the default in-process Local provider:

using Nutrient;

Opening the image file

Open the image with a using statement(opens in a new tab). The Local provider is the default provider, so no endpoint or model-server configuration is required.

In this sample:

  • The SDK supports PNG, JPEG, GIF, BMP, and TIFF.
  • Required model files download automatically on first use.
  • GPU acceleration is used when available.

The first run requires internet access to download the model files. Later runs use the persistent SDK resource cache. Ensure the application can write to that cache and has enough memory for the model.

try
{
using Document document = Document.Open("input_photo.png");

Creating a vision instance

Create a vision instance with Vision.Set(document).

Before calling vision methods, ensure the application has access to the SDK resource cache location and enough memory for the local model.

Vision vision = Vision.Set(document);

Generating the description

Call vision.Describe() to generate a natural language description.

The SDK prepares the image, runs the built-in model, and returns its description:

string description = vision.Describe();

Outputting the description

Print the description for review, or store it in your application.

Common destinations include:

  • Database fields
  • JSON output files
  • HTML alt attributes
Console.WriteLine("Image description:");
Console.WriteLine(description);
}
catch (NutrientException e)
{
Console.Error.WriteLine($"Error: {e.Message}");
Environment.Exit(1);
}

Understanding the output

Describe() returns natural language text generated by the local model.

Descriptions are typically:

  • Concise — Focused on key subjects and details, often one to three sentences
  • Accessible — Suitable for users who rely on screen readers
  • Accurate — Based on visible content only
  • Model-dependent quality — Quality varies by model architecture and size

Use this output for accessibility metadata, image search, and document workflows, all with local processing.

Error handling

The SDK throws a NutrientException when vision operations fail.

Common failure scenarios include:

  • The input image can’t be read due to path, permission, or format issues
  • Required local model files can’t be downloaded or read from the SDK resource cache
  • Available CPU/GPU memory is insufficient for the local model
  • Responses time out on large images or heavy models

In production code:

  • Catch NutrientException.
  • Return a clear error message.
  • Log failure details for debugging.
  • Add retry logic for transient model download or processing issues.

Conclusion

Use this workflow to generate image descriptions with local AI:

  1. Open the image file with a using statement for automatic resource cleanup.
  2. The SDK supports multiple image formats, including PNG, JPEG, GIF, BMP, and TIFF.
  3. The SDK uses the in-process Local provider by default, downloads required model files automatically, and uses GPU acceleration when available.
  4. Create a vision instance with Vision.Set() bound to the document.
  5. Generate the description with vision.Describe(), which processes the image with the built-in model and returns natural language text.
  6. Print or save the description for use in accessibility systems, content management, or cataloging workflows.
  7. Handle NutrientException for vision processing failures, including model download, resource-cache, memory, or timeout errors.

To use an external OpenAI-compatible local VLM endpoint, refer to the custom local AI endpoint guide. For related image workflows, refer to the .NET SDK guides.

Download this ready-to-use sample package to explore local AI image description.