agentleFS
aspose-imagingaspose-imaging/agentic-net-examples/working-with-drawing-images/agents.md

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

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
  1. Distinctive:

    Create PNG image canvas

    line 149
  2. Distinctive:

    Create BMP image with 90‑degree arc

    line 157
  3. Distinctive:

    If you need to turn raster drawings into other formats, the Convert Raster Image category provides examples for exporting PNG or BMP files …

    line 191
  4. Distinctive:

    When your workflow involves turning SVG files into raster graphics (e.g., thumbnails) before further processing, see Convert Svg To Raster …

    line 192
  5. Very specific:

    Create a GraphicsPath, add a BezierSegment with the desired control points, and render it onto a RasterImage via a Graphics object.

    line 220
  6. Very specific:

    Use BmpImage (or RasterImage.Create) together with ImageOptions and a MemorySource to supply the integer pixel array, then save the image.

    line 226
  7. Very specific:

    Call the Clear method on the RasterImage (or fill it with a transparent brush) to reset the canvas without changing width or height.

    line 232

≈ “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

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-specific
  • using Aspose.Imaging; (199/401 files) ← category-specific
  • using Aspose.Imaging.Sources; (136/401 files) ← category-specific
  • using Aspose.Imaging.Brushes; (61/401 files) ← category-specific
  • using Aspose.Imaging.Shapes; (37/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Svg; (25/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Bmp; (22/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Png; (21/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Pdf; (14/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Tiff.Enums; (12/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Wmf; (12/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Eps; (12/401 files) ← category-specific
  • using System.Collections.Generic; (8/401 files)
  • using Aspose.Imaging.FileFormats.Emf; (7/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Jpeg; (6/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Svg.Graphics; (5/401 files) ← category-specific
  • using System.Linq; (3/401 files)
  • using Aspose.Imaging.FileFormats.Tiff; (2/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Emf.Graphics; (2/401 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Wmf.Consts; (1/401 files) ← category-specific
  • using Aspose.Imaging.CoreExceptions.ImageFormats; (1/401 files) ← category-specific
  • using Aspose.Imaging.CoreExceptions; (1/401 files) ← category-specific
  • using Aspose.Imaging.ImageFilters.FilterOptions; (1/401 files) ← category-specific
  • using Aspose.Imaging.Masking; (1/401 files) ← category-specific
  • using Aspose.Imaging.Masking.Options; (1/401 files) ← category-specific
  • using Aspose.Imaging.Masking.Result; (1/401 files) ← category-specific

Files in this folder

FileKey APIsDescription
create-a-200-200-bmp-image-clear-background-to-red-and-save-to-file.csBmpOptions, Graphics, RasterImageCreate 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.csBmpOptions, Graphics, RasterImageGenerate 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.csBmpOptions, GraphicsInitialize 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.csBmpOptions, SolidBrushUse 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.csBmpOptionsClear 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.csBmpOptionsCreate 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.csBmpOptions, Graphics, SolidBrushClear 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.csBmpOptionsCreate 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.csBmpOptions, GraphicsCreate 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.csBmpOptionsCreate 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.csGraphics, PngOptions, SolidBrushDraw 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.csBmpOptionsDraw 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.csBmpOptions, Graphics, SolidBrushCreate 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.csBmpOptions, GraphicsCreate 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.csGraphics, PngOptionsDraw 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.csBmpOptions, GraphicsGenerate 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.csBmpOptions, GraphicsDraw 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.csBmpOptions, GraphicsDraw 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.csBmpOptionsRender 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.csBmpOptions, GraphicsImplement 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.csBmpOptionsApply 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.csBmpOptions, GraphicsUse 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.csBmpOptionsUse 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.csBmpImage, BmpOptions, GraphicsCreate 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.csGraphics, PngOptionsUse Graphics.DrawRectangle overload with location and size parameters to outline...
use-graphics-drawrectangle-overload-with-a-rectanglef-structure-to-draw-a-floating-point-rectangle.csGraphics, PngOptionsUse 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.csBmpOptionsDraw 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.csBmpOptions, Graphics, SolidBrushCreate 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.csBmpOptions, SolidBrushCreate 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.csBmpOptions, GraphicsGenerate a BMP canvas, draw multiple arcs to compose a semi‑circular gauge indic...
...and 371 more filesView all

Category Statistics

  • Total examples: 401
  • Failed: 0
  • Pass rate: 100.0%

Key API Surface

  • ApngOptions
  • BmpImage
  • BmpOptions
  • Color
  • ConvolutionFilterOptions
  • EmfImage
  • EmfOptions
  • EmfRasterizationOptions
  • EpsImage
  • EpsLoadOptions
  • EpsRasterizationOptions
  • GaussianBlurFilterOptions
  • GifImage
  • GifOptions
  • Graphics
  • HatchBrush
  • IcoImage
  • IcoOptions
  • Jpeg2000Image
  • Jpeg2000LoadOptions
  • Jpeg2000Options
  • JpegImage
  • JpegOptions
  • JsonSerializerOptions
  • LinearGradientBrush
  • LoadOptions
  • MaskingOptions
  • MetaImage
  • MultiPageOptions
  • PathGradientBrush
  • PdfCoreOptions
  • PdfOptions
  • PngImage
  • PngOptions
  • RasterImage
  • SharpenFilterOptions
  • SolidBrush
  • StringFormat
  • SvgImage
  • SvgOptions
  • SvgRasterizationOptions
  • TextureBrush
  • TiffFrame
  • TiffImage
  • TiffOptions
  • VectorRasterizationOptions
  • WmfImage
  • WmfOptions
  • WmfRasterizationOptions

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 an Image object.
  • 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 Graphics together with CubicBezierShape to 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 PdfOptions API.
  • 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
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
<!-- 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

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.