agentic-net-examples
AGENTS.md1 starsChanged 7 months agoMITView on GitHub
AI-friendly C# code examples for Aspose.Imaging for .NET
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository17 other files it gives its agents.
- conversionAGENTS.md
- convert-apngAGENTS.md
- convert-cdrAGENTS.md
- convert-cmx-imagesAGENTS.md
- convert-dicom-imagesAGENTS.md
- convert-eps-imagesAGENTS.md
- converting-wmf-and-emfAGENTS.md
- convert-open-document-graphicsAGENTS.md
- convert-raster-imageAGENTS.md
- convert-svg-to-raster-imagesAGENTS.md
- convert-webp-imagesAGENTS.md
- image-and-photo-filtersAGENTS.md
- kernel-filtersAGENTS.md
- manipulate-different-image-file-formatsAGENTS.md
- manipulating-imagesAGENTS.md
- merge-imagesAGENTS.md
- working-with-drawing-imagesAGENTS.md
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
- Distinctive: line 16
When working in this repository:
- Very specific: line 18
All examples must compile and run without errors using dotnet build and dotnet run
- Distinctive: line 19
Follow the conventions, boundaries, and anti-patterns documented below exactly
- Distinctive: line 20
Use the Command Reference section for build/run commands
- Distinctive: line 154
Check with a human before doing any of these:
- Distinctive: line 156
Using deprecated APIs: - check the Aspose.Imaging changelog for the current API surface
- Very specific: line 162
Never use var for variable declarations
- Very specific: line 163
Never use unqualified Image - always use Aspose.Imaging.Image
- Very specific: line 164
Never forget to dispose images - always use using blocks
- Distinctive: line 165
Never modify agents.md files - they are auto-generated
- Very specific: line 166
Never modify the .csproj template - it is generated
- Distinctive: line 284
Every example must pass these verification steps.
≈ “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.
Files
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
.csfile is a standalone Console Application - do not create multi-file projects - All examples must compile and run without errors using
dotnet buildanddotnet 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
.csfile - Using deprecated APIs - check the Aspose.Imaging changelog for the current API surface
- Adding NuGet packages beyond
Aspose.Imaging- the.csprojtemplate only includes Aspose.Imaging - Modifying shared infrastructure -
.csprojtemplates,agents.mdfiles, CI configs
Never
- Never use
varfor variable declarations - Never use unqualified
Image- always useAspose.Imaging.Image - Never forget to dispose images - always use
usingblocks - Never modify
agents.mdfiles - they are auto-generated - Never modify the
.csprojtemplate - 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
| Category | Examples | Pass Rate | Details |
| Conversion | 162 | 100.0% | agents.md |
| Convert APNG | 51 | 100.0% | agents.md |
| Convert CDR | 30 | 100.0% | agents.md |
| Convert CMX Images | 34 | 100.0% | agents.md |
| Convert DICOM Images | 30 | 100.0% | agents.md |
| Convert EPS Images | 60 | 100.0% | agents.md |
| Convert Open Document Graphics | 120 | 100.0% | agents.md |
| Convert Raster Image | 139 | 100.0% | agents.md |
| Convert SVG to Raster Images | 40 | 100.0% | agents.md |
| Convert webp Images | 30 | 100.0% | agents.md |
| Converting WMF and EMF | 29 | 100.0% | agents.md |
| Image and Photo Filters | 148 | 100.0% | agents.md |
| Kernel Filters | 465 | 100.0% | agents.md |
| Manipulate Different Image File Formats | 602 | 100.0% | agents.md |
| Manipulating Images | 425 | 100.0% | agents.md |
| Merge Images | 135 | 100.0% | agents.md |
| Working With Drawing Images | 401 | 100.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 runProject 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
CSerror codes in output - Failure: Any
error CS####line indicates a build failure
Common Error Codes
| Code | Meaning | Fix |
CS0104 | Ambiguous type reference | Use Aspose.Imaging.Image fully qualified |
CS1061 | Member does not exist on type | Check Aspose.Imaging API docs |
CS0246 | Type or namespace not found | Add missing using directive |
CS0029 | Cannot convert type | Cast 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
- Navigate to any category folder
- Each .cs file is a standalone Console Application
- 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.
| Resource | Link |
| 📖 Documentation | docs.aspose.com/imaging/net |
| 📦 NuGet Package | www.nuget.org/packages/aspose.imaging |
| 🚀 Release Notes | releases.aspose.com/imaging/net |
| 🌐 Online Apps | products.aspose.app/imaging/family |
| 🔑 Free Temporary License | purchase.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-codeendpoint 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.csfile), or"both".
- Outputs
code– a complete C# example (includingusingstatements, 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.csfile whenoutputModeincludes"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
| Task | Category | Key Classes |
| Load an image from file, stream, or byte array | manipulating-images | Image, ImageLoadOptions |
| Save or convert an image to PNG, JPEG, BMP, GIF, etc. | conversion | Image, ImageSaveOptions, PngOptions, JpegOptions, BmpOptions, GifOptions |
| Convert APNG to another format (e.g., PNG, JPEG) | convert-apng | ApngImage, ImageSaveOptions, PngOptions |
| Convert CorelDRAW (CDR) files to raster formats | convert-cdr | CdrImage, ImageSaveOptions, PngOptions |
| Convert CMX vector images to raster formats | convert-cmx-images | CmxImage, ImageSaveOptions, JpegOptions |
| Convert DICOM medical images to common formats | convert-dicom-images | DicomImage, ImageSaveOptions, PngOptions |
| Convert EPS files to raster images | convert-eps-images | EpsImage, ImageSaveOptions, BmpOptions |
| Convert OpenDocument graphics (ODG) to PNG/JPEG | convert-open-document-graphics | OdgImage, ImageSaveOptions, PngOptions |
| Render SVG files to raster images (PNG, JPEG) | convert-svg-to-raster-images | SvgImage, RasterImage, ImageSaveOptions, PngOptions |
| Convert WebP images to other formats or vice‑versa | convert-webp-images | WebPImage, ImageSaveOptions, WebpOptions |
| Convert WMF or EMF vector drawings to raster images | converting-wmf-and-emf | WmfImage, EmfImage, ImageSaveOptions, PngOptions |
| Apply photo filters (e.g., Sepia, Grayscale) | image-and-photo-filters | Image, Filter, FilterOptions, SepiaFilter, GrayscaleFilter |
| Apply kernel‑based filters (e.g., Gaussian blur, Sharpen) | kernel-filters | Image, Filter, GaussianBlurFilter, SharpenFilter |
| Resize, rotate, or crop an image | manipulating-images | Image, ImageProcessor, ResizeOptions, RotateFlipType, Rectangle |
| Merge multiple images into a single canvas | merge-images | Image, ImageCollection, ImageCombiner, ImageSaveOptions |
| Draw shapes or text on vector/raster images | working-with-drawing-images | VectorImage, Graphics, Pen, Brush, Font |
<!-- AUTOGENERATED:START -->Updated: 2026-06-29 | Run: 20260629_035455 | Examples: 4856 | Categories: 17
<!-- AUTOGENERATED:END -->Related Agentic .NET Example Repositories
| Repository | Product |
| aspose-pdf/agentic-net-examples | Aspose.PDF for .NET |
| aspose-words/agentic-net-examples | Aspose.Words for .NET |
| aspose-cells/agentic-net-examples | Aspose.Cells for .NET |
| aspose-slides/agentic-net-examples | Aspose.Slides for .NET |
| aspose-email/agentic-net-examples | Aspose.Email for .NET |
| aspose-barcode/agentic-net-examples | Aspose.BarCode for .NET |
Maintained by an agentic example generation workflow | For AI-friendly guidance, see AGENTS.md | Last updated: 2026-06-29
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
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.

