agentic-net-examples / working-with-drawing-images
AGENTS.md1 starsChanged 7 months agoMITView on GitHub
C# examples for Working With Drawing Images using 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.
- aspose-imaging-examplesAGENTS.md
- 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
The file
We split this agents.md into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 149
Create PNG image canvas
- Distinctive: line 157
Create BMP image with 90‑degree arc
- Distinctive: line 191
If you need to turn raster drawings into other formats, the Convert Raster Image category provides examples for exporting PNG or BMP files …
- Distinctive: line 192
When your workflow involves turning SVG files into raster graphics (e.g., thumbnails) before further processing, see Convert Svg To Raster …
- Very specific: line 220
Create a GraphicsPath, add a BezierSegment with the desired control points, and render it onto a RasterImage via a Graphics object.
- Very specific: line 226
Use BmpImage (or RasterImage.Create) together with ImageOptions and a MemorySource to supply the integer pixel array, then save the image.
- Very specific: line 232
Call the Clear method on the RasterImage (or fill it with a transparent brush) to reset the canvas without changing width or height.
≈ “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
AGENTS - Working With Drawing Images
Persona
You are a C# developer specializing in image processing using Aspose.Imaging for .NET, working within the Working With Drawing Images category. This folder contains standalone C# examples for Working With Drawing Images operations. See the root agents.md for repository-wide conventions and boundaries.
Required Namespaces
using System;(242/401 files)using System.IO;(242/401 files)using Aspose.Imaging.ImageOptions;(234/401 files) ← category-specificusing Aspose.Imaging;(199/401 files) ← category-specificusing Aspose.Imaging.Sources;(136/401 files) ← category-specificusing Aspose.Imaging.Brushes;(61/401 files) ← category-specificusing Aspose.Imaging.Shapes;(37/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Svg;(25/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Bmp;(22/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Png;(21/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Pdf;(14/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Tiff.Enums;(12/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Wmf;(12/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Eps;(12/401 files) ← category-specificusing System.Collections.Generic;(8/401 files)using Aspose.Imaging.FileFormats.Emf;(7/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Jpeg;(6/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Svg.Graphics;(5/401 files) ← category-specificusing System.Linq;(3/401 files)using Aspose.Imaging.FileFormats.Tiff;(2/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Emf.Graphics;(2/401 files) ← category-specificusing Aspose.Imaging.FileFormats.Wmf.Consts;(1/401 files) ← category-specificusing Aspose.Imaging.CoreExceptions.ImageFormats;(1/401 files) ← category-specificusing Aspose.Imaging.CoreExceptions;(1/401 files) ← category-specificusing Aspose.Imaging.ImageFilters.FilterOptions;(1/401 files) ← category-specificusing Aspose.Imaging.Masking;(1/401 files) ← category-specificusing Aspose.Imaging.Masking.Options;(1/401 files) ← category-specificusing Aspose.Imaging.Masking.Result;(1/401 files) ← category-specific
Files in this folder
| File | Key APIs | Description |
| create-a-200-200-bmp-image-clear-background-to-red-and-save-to-file.cs | BmpOptions, Graphics, RasterImage | Create a 200 × 200 BMP image, clear background to red, and save to file. |
| generate-a-500-300-bmp-canvas-and-draw-a-blue-line-from-50-50-to-450-250.cs | BmpOptions, Graphics, RasterImage | Generate a 500 × 300 BMP canvas and draw a blue line from (50,50) to (450,250). |
| initialize-a-memorystream-create-a-bmp-image-draw-a-green-rectangle-and-write-to-stream.cs | BmpOptions, Graphics | Initialize a MemoryStream, create a BMP image, draw a green rectangle, and write... |
| use-bmpoptions-with-a-filestream-source-to-produce-a-400-400-bmp-filled-with-yellow.cs | BmpOptions, SolidBrush | Use BmpOptions with a FileStream source to produce a 400 × 400 BMP filled with y... |
| clear-a-bmp-image-to-light-gray-then-draw-multiple-red-lines-forming-a-grid.cs | BmpOptions | Clear a BMP image to light gray, then draw multiple red lines forming a grid. |
| create-a-bmp-image-set-background-to-white-then-draw-a-series-of-random-colored-lines.cs | BmpOptions | Create a BMP image, set background to white, then draw a series of random colore... |
| clear-a-bmp-image-to-light-blue-then-draw-overlapping-semi-transparent-rectangles.cs | BmpOptions, Graphics, SolidBrush | Clear a BMP image to light blue, then draw overlapping semi‑transparent rectangl... |
| create-a-bmp-clear-to-dark-gray-then-draw-a-bright-yellow-diagonal-line.cs | BmpOptions | Create a BMP, clear to dark gray, then draw a bright yellow diagonal line. |
| create-a-bmp-clear-to-ivory-then-draw-diagonal-lines-forming-a-hatch-pattern.cs | BmpOptions, Graphics | Create a BMP, clear to ivory, then draw diagonal lines forming a hatch pattern. |
| create-a-bmp-image-clear-to-teal-then-draw-a-white-ellipse-centered-in-the-canvas.cs | BmpOptions | Create a BMP image, clear to teal, then draw a white ellipse centered in the can... |
| draw-a-filled-blue-rectangle-with-solidbrush-and-outline-it-using-a-thick-black-pen.cs | Graphics, PngOptions, SolidBrush | Draw a filled blue rectangle with SolidBrush and outline it using a thick black ... |
| draw-an-ellipse-inside-a-300-200-rectangle-using-a-black-pen-and-save-the-bmp.cs | BmpOptions | Draw an ellipse inside a 300 × 200 rectangle using a black Pen and save the BMP. |
| create-a-bmp-image-draw-a-filled-ellipse-with-solidbrush-then-outline-it-using-a-contrasting-pen.cs | BmpOptions, Graphics, SolidBrush | Create a BMP image, draw a filled ellipse with SolidBrush, then outline it using... |
| create-a-bmp-image-draw-a-90-degree-arc-within-a-defined-rectangle-and-save-file.cs | BmpOptions, Graphics | Create a BMP image, draw a 90‑degree arc within a defined rectangle, and save fi... |
| draw-an-arc-starting-at-45-degrees-sweeping-180-degrees-inside-a-400-200-rectangle.cs | Graphics, PngOptions | Draw an arc starting at 45 degrees, sweeping 180 degrees inside a 400 × 200 rect... |
| generate-a-250-250-bmp-draw-a-bezier-curve-with-four-control-points-export-to-memorystream.cs | BmpOptions, Graphics | Generate a 250 × 250 BMP, draw a Bezier curve with four control points, export t... |
| draw-a-bezier-curve-that-approximates-a-circle-by-defining-appropriate-control-points-on-bmp.cs | BmpOptions, Graphics | Draw a Bezier curve that approximates a circle by defining appropriate control p... |
| draw-a-series-of-bezier-curves-connecting-sequential-points-to-form-a-wave-pattern-on-bmp.cs | BmpOptions, Graphics | Draw a series of Bezier curves connecting sequential points to form a wave patte... |
| render-a-diagonal-orange-line-across-a-600-600-bmp-using-graphics-drawline-overload-with-coordinates.cs | BmpOptions | Render a diagonal orange line across a 600 × 600 BMP using Graphics.DrawLine ove... |
| implement-a-loop-that-draws-ten-equally-spaced-vertical-lines-on-a-bmp-using-a-thin-pen.cs | BmpOptions, Graphics | Implement a loop that draws ten equally spaced vertical lines on a BMP using a t... |
| apply-a-custom-dash-style-to-a-pen-and-draw-a-dashed-line-across-the-bmp.cs | BmpOptions | Apply a custom dash style to a Pen and draw a dashed line across the BMP. |
| use-a-pen-with-rounded-line-caps-to-draw-smooth-curves-on-a-bmp-canvas.cs | BmpOptions, Graphics | Use a Pen with rounded line caps to draw smooth curves on a BMP canvas. |
| use-a-pen-with-increased-width-to-draw-a-bold-rectangle-border-around-the-bmp-canvas.cs | BmpOptions | Use a Pen with increased width to draw a bold rectangle border around the BMP ca... |
| create-a-bmp-image-clear-to-navy-and-draw-a-white-diagonal-cross-using-two-lines.cs | BmpImage, BmpOptions, Graphics | Create a BMP image, clear to navy, and draw a white diagonal cross using two lin... |
| use-graphics-drawrectangle-overload-with-location-and-size-parameters-to-outline-a-green-square.cs | Graphics, PngOptions | Use Graphics.DrawRectangle overload with location and size parameters to outline... |
| use-graphics-drawrectangle-overload-with-a-rectanglef-structure-to-draw-a-floating-point-rectangle.cs | Graphics, PngOptions | Use Graphics.DrawRectangle overload with a RectangleF structure to draw a floati... |
| draw-an-ellipse-with-a-pen-that-has-a-custom-dash-pattern-on-a-bmp-background.cs | BmpOptions | Draw an ellipse with a Pen that has a custom dash pattern on a BMP background. |
| create-a-bmp-draw-a-rectangle-using-a-pen-constructed-from-a-solidbrush-with-custom-color.cs | BmpOptions, Graphics, SolidBrush | Create a BMP, draw a rectangle using a Pen constructed from a SolidBrush with cu... |
| create-a-bmp-draw-a-rectangle-then-fill-its-interior-using-solidbrush-with-solid-color.cs | BmpOptions, SolidBrush | Create a BMP, draw a rectangle then fill its interior using SolidBrush with soli... |
| generate-a-bmp-canvas-draw-multiple-arcs-to-compose-a-semi-circular-gauge-indicator.cs | BmpOptions, Graphics | Generate a BMP canvas, draw multiple arcs to compose a semi‑circular gauge indic... |
| ...and 371 more files | View all |
Category Statistics
- Total examples: 401
- Failed: 0
- Pass rate: 100.0%
Key API Surface
ApngOptionsBmpImageBmpOptionsColorConvolutionFilterOptionsEmfImageEmfOptionsEmfRasterizationOptionsEpsImageEpsLoadOptionsEpsRasterizationOptionsGaussianBlurFilterOptionsGifImageGifOptionsGraphicsHatchBrushIcoImageIcoOptionsJpeg2000ImageJpeg2000LoadOptionsJpeg2000OptionsJpegImageJpegOptionsJsonSerializerOptionsLinearGradientBrushLoadOptionsMaskingOptionsMetaImageMultiPageOptionsPathGradientBrushPdfCoreOptionsPdfOptionsPngImagePngOptionsRasterImageSharpenFilterOptionsSolidBrushStringFormatSvgImageSvgOptionsSvgRasterizationOptionsTextureBrushTiffFrameTiffImageTiffOptionsVectorRasterizationOptionsWmfImageWmfOptionsWmfRasterizationOptions
Failed Tasks
All tasks passed ✅
Operations Covered
- Create PNG image canvas
- Draw cubic Bezier curve on image
- Batch convert SVG icons to PDF
- Embed vector objects in PDF output
- Embed fonts in generated PDF
- Set PDF version to 1.6
- Convert multi‑page SVG to single PDF preserving order
- Preserve vector fidelity during SVG‑to‑PDF conversion
- Create BMP image with 90‑degree arc
- Generate bar chart with data labels
- Export chart as PDF document
- Draw Bezier curve and save to MemoryStream
Supported Formats
- PNG – used as the drawing surface and final output for raster graphics.
- BMP – created with custom bit‑depth options and saved to disk or memory.
- SVG – source vector graphics that are loaded and converted to PDF.
- PDF – target format for vector‑based conversions, chart export, and embedded‑font PDFs.
API Classes Used
PngOptions— defines settings (e.g., source, compression) for creating or saving PNG files.BmpOptions— specifies BMP creation parameters such as bits‑per‑pixel and output source.FileCreateSource— represents a file‑based stream used to write newly created images.Image— core class for loading, creating, and manipulating images of any supported format.Graphics— provides drawing primitives (lines, curves, arcs, etc.) to render shapes onto an image.PdfOptions— configures PDF generation options, including version number and font embedding.Image.Load— static method that loads an existing image file (e.g., SVG) into anImageobject.Image.Create— static method that creates a blank image with specified dimensions and options.Aspose.Imaging.Brushes(e.g.,SolidBrush) — supplies brush objects for filling shapes.Aspose.Imaging.Shapes(e.g.,Bezier,Arc) — contains shape classes used to draw curves and arcs.Aspose.Imaging.FileFormats.Pdf— namespace providing PDF‑specific classes and utilities.Aspose.Imaging.FileFormats.Svg— namespace offering SVG‑specific handling and conversion support.
Use Cases
- When you need to add a smooth curve to a generated PNG, you can use
Graphicstogether withCubicBezierShapeto draw a cubic bezier curve on PNG exactly as shown in the “add‑a‑cubic‑bezier‑curve‑to‑the‑same‑figure‑using‑specified‑control‑points” example. - If your project ships a set of SVG icons and you must deliver them as a single, scalable PDF for printing, the “batch‑convert‑svg‑icons‑to‑pdf‑embedding‑each‑icon‑as‑a‑vector‑object‑for‑scalable‑printing” sample demonstrates how to batch convert SVG icons to vector PDF in C# with Aspose.Imaging.
- For compliance‑driven reports that require all fonts to be embedded, the “batch‑process‑vector‑graphics‑converting‑each‑to‑pdf‑with‑embedded‑fonts‑and‑setting‑pdf‑version‑to‑1‑6” code shows how to convert vector images to PDF with embedded fonts using the
PdfOptionsAPI. - When you receive a multi‑page SVG (e.g., a multi‑sheet diagram) and must produce one PDF that keeps the original page sequence, the “convert‑a‑multi‑page‑svg‑document‑to‑a‑single‑pdf‑file‑preserving‑page‑order‑and‑vector‑fidelity” example illustrates how to preserve page order when converting multi‑page SVG to a single PDF.
- To create a blank canvas and draw basic shapes such as rectangles, ellipses, or arcs before saving as PNG, the “create‑a‑bmp‑image‑draw‑a‑90‑degree‑arc‑within‑a‑defined‑rectangle‑and‑save‑file” snippet can be adapted to create a PNG image and draw shapes using Aspose.Imaging Graphics.
Related Categories
If you need to turn raster drawings into other formats, the Convert Raster Image category provides examples for exporting PNG or BMP files to JPEG, TIFF, and more.
When your workflow involves turning SVG files into raster graphics (e.g., thumbnails) before further processing, see Convert Svg To Raster Images for straightforward conversions using Aspose.Imaging.
For post‑processing tasks such as applying color corrections or filters to the images you create with drawing APIs, the Image And Photo Filters section offers a rich set of filter examples that can be chained after drawing operations.
Get Started
Ready to try Working With Drawing Images conversions on your own files with Aspose.Imaging for .NET?
dotnet add package Aspose.Imaging| 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 |
<!-- AUTOGENERATED:START -->Updated: 2026-09-16 | Run: 20260731_113931 | Examples: 401
<!-- AUTOGENERATED:END -->Developer Q&A
Q: How can I draw a cubic Bezier curve on a PNG image using Aspose.Imaging in C#?
Create a GraphicsPath, add a BezierSegment with the desired control points, and render it onto a RasterImage via a Graphics object. → See: add-a-cubic-bezier-curve-to-the-same-figure-using-specified-control-points.cs
Q: How do I generate multiple BMP files each with a different background color and a centered black ellipse using Aspose.Imaging?
Iterate over the color list, instantiate a new BmpImage with ImageOptions, fill the background with a SolidBrush, draw the centered ellipse using Graphics, and save each file. → See: batch-generate-bmp-files-each-containing-a-different-background-color-and-a-centered-black-ellipse.cs
Q: How can I create a BMP image from raw ARGB pixel data with Aspose.Imaging?
Use BmpImage (or RasterImage.Create) together with ImageOptions and a MemorySource to supply the integer pixel array, then save the image. → See: generate-a-bmp-image-file-from-provided-pixel-data-using-the-library-s-image-creation-api.cs
Q: How do I apply a motion blur effect to an SVG and export it as a high‑quality JPEG using Aspose.Imaging?
Load the SVG with Image.Load, apply MotionBlurFilter via ImageProcessor, and save the result with JpegOptions specifying the desired quality. → See: load-a-vector-image-apply-a-motion-blur-effect-and-export-the-blurred-result-as-a-high-quality-jpeg.cs
Q: How can I clear all pixel data of an image while preserving its original dimensions in Aspose.Imaging?
Call the Clear method on the RasterImage (or fill it with a transparent brush) to reset the canvas without changing width or height. → See: reset-the-image-canvas-to-a-blank-state-by-clearing-all-pixel-data-while-preserving-its-dimensions.cs
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.

