agentleFS
aspose-imagingaspose-imaging/agentic-net-examples/agents.md

agentic-net-examples

AGENTS.md1 starsChanged 7 months agoMITView on GitHub

AI-friendly C# code examples for Aspose.Imaging for .NET

The file

We split this agents.md into the rules it gives an agent

12 rules. About 0 are common, 7 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    When working in this repository:

    line 16
  2. Very specific:

    All examples must compile and run without errors using dotnet build and dotnet run

    line 18
  3. Distinctive:

    Follow the conventions, boundaries, and anti-patterns documented below exactly

    line 19
  4. Distinctive:

    Use the Command Reference section for build/run commands

    line 20
  5. Distinctive:

    Check with a human before doing any of these:

    line 154
  6. Distinctive:

    Using deprecated APIs: - check the Aspose.Imaging changelog for the current API surface

    line 156
  7. Very specific:

    Never use var for variable declarations

    line 162
  8. Very specific:

    Never use unqualified Image - always use Aspose.Imaging.Image

    line 163
  9. Very specific:

    Never forget to dispose images - always use using blocks

    line 164
  10. Distinctive:

    Never modify agents.md files - they are auto-generated

    line 165
  11. Very specific:

    Never modify the .csproj template - it is generated

    line 166
  12. Distinctive:

    Every example must pass these verification steps.

    line 284

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
agents.md

Aspose.Imaging for .NET Examples

AI-friendly index of compiler-validated C# examples for Aspose.Imaging for .NET.

Persona

You are a C# developer specializing in image processing using Aspose.Imaging for .NET. When working in this repository:

  • Each .cs file is a standalone Console Application - do not create multi-file projects
  • All examples must compile and run without errors using dotnet build and dotnet run
  • Follow the conventions, boundaries, and anti-patterns documented below exactly
  • Use the Command Reference section for build/run commands

Repository Overview

This repository contains 4856 working code examples demonstrating Aspose.Imaging for .NET capabilities.

Statistics (as of 2026-06-29):

  • Total Examples: 2901
  • Categories: 17
  • Overall Pass Rate: 100.0%

Category Details

conversion

  • Examples: 162
  • Guide: agents.md

convert-apng

  • Examples: 102
  • Guide: agents.md

convert-cdr

  • Examples: 120
  • Guide: agents.md

convert-cmx-images

  • Examples: 102
  • Guide: agents.md

convert-dicom-images

  • Examples: 60
  • Guide: agents.md

convert-eps-images

  • Examples: 120
  • Guide: agents.md

convert-open-document-graphics

  • Examples: 240
  • Guide: agents.md

convert-raster-image

  • Examples: 279
  • Guide: agents.md

convert-svg-to-raster-images

  • Examples: 80
  • Guide: agents.md

convert-webp-images

  • Examples: 60
  • Guide: agents.md

converting-wmf-and-emf

  • Examples: 58
  • Guide: agents.md

image-and-photo-filters

  • Examples: 282
  • Guide: agents.md

kernel-filters

  • Examples: 695
  • Guide: agents.md

manipulate-different-image-file-formats

  • Examples: 1032
  • Guide: agents.md

manipulating-images

  • Examples: 650
  • Guide: agents.md

merge-images

  • Examples: 175
  • Guide: agents.md

working-with-drawing-images

  • Examples: 639
  • Guide: agents.md

Boundaries

Always

These rules are mandatory for every example.

Use explicit types - never use var

// CORRECT
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load("input.png"))
{
    RasterImage raster = (RasterImage)image;
    PngOptions options = new PngOptions();
}

// WRONG
// var image = Aspose.Imaging.Image.Load("input.png");

Use using blocks for IDisposable objects

// CORRECT
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load("input.png"))
{
    image.Save("output.png");
}

// WRONG - memory leak, file lock not released
// Aspose.Imaging.Image image = Aspose.Imaging.Image.Load("input.png");
// image.Save("output.png");

Fully qualify the Image class to avoid ambiguity

// CORRECT
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load("input.png"))
{ }

// WRONG - ambiguous with System.Drawing.Image
// using (Image image = Image.Load("input.png")) { }

Save the image after all modifications

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load("input.png"))
{
    // ... make modifications ...
    image.Save("output.png");
}

Ask First

Check with a human before doing any of these:

  • Creating multi-file projects - each example must be a single .cs file
  • Using deprecated APIs - check the Aspose.Imaging changelog for the current API surface
  • Adding NuGet packages beyond Aspose.Imaging - the .csproj template only includes Aspose.Imaging
  • Modifying shared infrastructure - .csproj templates, agents.md files, CI configs

Never

  • Never use var for variable declarations
  • Never use unqualified Image - always use Aspose.Imaging.Image
  • Never forget to dispose images - always use using blocks
  • Never modify agents.md files - they are auto-generated
  • Never modify the .csproj template - it is generated

Common Mistakes (Anti-Patterns)

Unqualified Image Type

// WRONG - CS0104 ambiguous between System.Drawing.Image and Aspose.Imaging.Image
Image image = Image.Load("input.png");
// CORRECT
Aspose.Imaging.Image image = Aspose.Imaging.Image.Load("input.png");

Missing using block

// WRONG - memory leak, file lock not released
Aspose.Imaging.Image image = Aspose.Imaging.Image.Load("input.png");
image.Save("output.png");
// CORRECT
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load("input.png"))
{
    image.Save("output.png");
}

Using var

// WRONG
var image = Aspose.Imaging.Image.Load("input.png");
var options = new PngOptions();
// CORRECT
Aspose.Imaging.Image image = Aspose.Imaging.Image.Load("input.png");
PngOptions options = new PngOptions();

Repository Structure

agents.md
README.md
+-- conversion/
+-- convert-apng/
+-- convert-cdr/
+-- convert-cmx-images/
+-- convert-dicom-images/
+-- convert-eps-images/
+-- convert-open-document-graphics/
+-- convert-raster-image/
+-- convert-svg-to-raster-images/
+-- convert-webp-images/
+-- converting-wmf-and-emf/
+-- image-and-photo-filters/
+-- kernel-filters/
+-- manipulate-different-image-file-formats/
+-- manipulating-images/
+-- merge-images/
+-- working-with-drawing-images/

Category Index

CategoryExamplesPass RateDetails
Conversion162100.0%agents.md
Convert APNG51100.0%agents.md
Convert CDR30100.0%agents.md
Convert CMX Images34100.0%agents.md
Convert DICOM Images30100.0%agents.md
Convert EPS Images60100.0%agents.md
Convert Open Document Graphics120100.0%agents.md
Convert Raster Image139100.0%agents.md
Convert SVG to Raster Images40100.0%agents.md
Convert webp Images30100.0%agents.md
Converting WMF and EMF29100.0%agents.md
Image and Photo Filters148100.0%agents.md
Kernel Filters465100.0%agents.md
Manipulate Different Image File Formats602100.0%agents.md
Manipulating Images425100.0%agents.md
Merge Images135100.0%agents.md
Working With Drawing Images401100.0%agents.md

Command Reference

Build and Run

# Create a new project (if needed)
dotnet new console -n ExampleProject --framework net9.0

# Add Aspose.Imaging NuGet package
dotnet add package Aspose.Imaging

# Build
dotnet build --configuration Release --verbosity minimal

# Run
dotnet run

Project File (.csproj)

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Aspose.Imaging" Version="*" />
  </ItemGroup>
</Project>

Testing Guide

Every example must pass these verification steps.

Build Verification

dotnet build --configuration Release --verbosity minimal
  • Success: Exit code 0, no CS error codes in output
  • Failure: Any error CS#### line indicates a build failure

Common Error Codes

CodeMeaningFix
CS0104Ambiguous type referenceUse Aspose.Imaging.Image fully qualified
CS1061Member does not exist on typeCheck Aspose.Imaging API docs
CS0246Type or namespace not foundAdd missing using directive
CS0029Cannot convert typeCast explicitly or use correct type

How to Use These Examples

Prerequisites

  • .NET SDK (8.0 or higher)
  • Aspose.Imaging for .NET (via NuGet)

Running an Example

  1. Navigate to any category folder
  2. Each .cs file is a standalone Console Application
  3. Compile and run:
    dotnet run <example-file.cs>

Related Resources

Aspose.Imaging for .NET is a UI-agnostic backend API that integrates into any .NET application — ASP.NET Core, console apps, Azure Functions, Docker containers — without requiring a display or UI framework.

ResourceLink
📖 Documentationdocs.aspose.com/imaging/net
📦 NuGet Packagewww.nuget.org/packages/aspose.imaging
🚀 Release Notesreleases.aspose.com/imaging/net
🌐 Online Appsproducts.aspose.app/imaging/family
🔑 Free Temporary Licensepurchase.aspose.com/temporary-license
🤝 Consulting (paid implementation help)consulting.aspose.com

Agent Capabilities

  • MCP‑compatible image processing agent – can be invoked through an MCP server to perform on‑demand image‑processing tasks using Aspose.Imaging for .NET.
  • REST API for C# code generation – exposes a POST /generate-code endpoint that accepts a JSON payload describing the desired operation and returns ready‑to‑run C# snippets.
  • Agentic example generator for Aspose.Imaging – automatically creates complete, compilable examples for any of the supported categories (e.g., conversion, filters, merging, drawing, WMF/EMF handling).
  • AI agent for .NET image processing examples – interprets natural‑language requests such as “convert an APNG to PNG with lossless compression” and produces the corresponding C# code.
  • OpenAPI‑compatible imaging code generator – provides an OpenAPI specification that defines request/response schemas, enabling seamless integration with other LLM‑driven workflows.

Input / Output Specification

  • Inputs (JSON payload)
    • category – one of the repository categories (e.g., convert-apng, image-and-photo-filters).
    • source – local file path, URL, or base‑64 string of the input image.
    • targetFormat – desired output format (e.g., png, jpeg, webp).
    • options – optional dictionary of Aspose.Imaging settings (compression level, DPI, color depth, filter type, etc.).
    • outputMode – "code" (plain C# text), "file" (downloadable .cs file), or "both".
  • Outputs
    • code – a complete C# example (including using statements, method definition, and error handling) that performs the requested operation.
    • metadata – JSON object summarizing the operation (input type, output type, required NuGet packages, Aspose.Imaging version).
    • fileUrl (optional) – link to a generated .cs file when outputMode includes "file".

Core Functionalities

  • Image format conversion across all supported types (APNG, CDR, CMX, DICOM, EPS, Open Document Graphics, raster, SVG → raster, WebP, WMF/EMF, etc.).
  • Application of image and photo filters (kernel filters, color adjustments, sharpening, etc.).
  • Manipulation of different image file formats (cropping, resizing, rotating, metadata editing).
  • Merging and compositing images (layering, drawing primitives, combining multiple sources).
  • Working with drawing images (vector graphics, text overlay, shape creation).

These capabilities enable downstream AI agents and LLM systems to request, receive, and execute precise .NET imaging code tailored to any scenario covered by the Aspose.Imaging library.

Quick Reference

TaskCategoryKey Classes
Load an image from file, stream, or byte arraymanipulating-imagesImage, ImageLoadOptions
Save or convert an image to PNG, JPEG, BMP, GIF, etc.conversionImage, ImageSaveOptions, PngOptions, JpegOptions, BmpOptions, GifOptions
Convert APNG to another format (e.g., PNG, JPEG)convert-apngApngImage, ImageSaveOptions, PngOptions
Convert CorelDRAW (CDR) files to raster formatsconvert-cdrCdrImage, ImageSaveOptions, PngOptions
Convert CMX vector images to raster formatsconvert-cmx-imagesCmxImage, ImageSaveOptions, JpegOptions
Convert DICOM medical images to common formatsconvert-dicom-imagesDicomImage, ImageSaveOptions, PngOptions
Convert EPS files to raster imagesconvert-eps-imagesEpsImage, ImageSaveOptions, BmpOptions
Convert OpenDocument graphics (ODG) to PNG/JPEGconvert-open-document-graphicsOdgImage, ImageSaveOptions, PngOptions
Render SVG files to raster images (PNG, JPEG)convert-svg-to-raster-imagesSvgImage, RasterImage, ImageSaveOptions, PngOptions
Convert WebP images to other formats or vice‑versaconvert-webp-imagesWebPImage, ImageSaveOptions, WebpOptions
Convert WMF or EMF vector drawings to raster imagesconverting-wmf-and-emfWmfImage, EmfImage, ImageSaveOptions, PngOptions
Apply photo filters (e.g., Sepia, Grayscale)image-and-photo-filtersImage, Filter, FilterOptions, SepiaFilter, GrayscaleFilter
Apply kernel‑based filters (e.g., Gaussian blur, Sharpen)kernel-filtersImage, Filter, GaussianBlurFilter, SharpenFilter
Resize, rotate, or crop an imagemanipulating-imagesImage, ImageProcessor, ResizeOptions, RotateFlipType, Rectangle
Merge multiple images into a single canvasmerge-imagesImage, ImageCollection, ImageCombiner, ImageSaveOptions
Draw shapes or text on vector/raster imagesworking-with-drawing-imagesVectorImage, Graphics, Pen, Brush, Font
<!-- AUTOGENERATED:START -->

Updated: 2026-06-29 | Run: 20260629_035455 | Examples: 4856 | Categories: 17

<!-- AUTOGENERATED:END -->

Related Agentic .NET Example Repositories

RepositoryProduct
aspose-pdf/agentic-net-examplesAspose.PDF for .NET
aspose-words/agentic-net-examplesAspose.Words for .NET
aspose-cells/agentic-net-examplesAspose.Cells for .NET
aspose-slides/agentic-net-examplesAspose.Slides for .NET
aspose-email/agentic-net-examplesAspose.Email for .NET
aspose-barcode/agentic-net-examplesAspose.BarCode for .NET

Maintained by an agentic example generation workflow | For AI-friendly guidance, see AGENTS.md | Last updated: 2026-06-29

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.