agentleFS
aspose-imagingaspose-imaging/agentic-net-examples/convert-svg-to-raster-images/agents.md

agentic-net-examples / convert-svg-to-raster-images

AGENTS.md1 starsChanged 7 months agoMITView on GitHub

C# examples for Convert SVG to Raster Images using Aspose.Imaging for .NET

The file

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

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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:

    Add text watermark to BMP after SVG rasterization

    line 107
  2. Very specific:

    Use Aspose.Imaging’s BmpImage to load the rasterized BMP and draw the watermark with Graphics and Brushes.SolidBrush.

    line 156
  3. Very specific:

    Create a single SvgRasterizationOptions object and assign it to each PngOptions before calling Image.Save.

    line 159
  4. Very specific:

    Use await Image.LoadAsync to read the SVG and then await image.SaveAsync with PngOptions.

    line 168

≈ “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 - Convert SVG to Raster Images

Persona

You are a C# developer specializing in image processing using Aspose.Imaging for .NET, working within the Convert SVG to Raster Images category. This folder contains standalone C# examples for Convert SVG to Raster Images operations. See the root agents.md for repository-wide conventions and boundaries.

Required Namespaces

  • using Aspose.Imaging; (41/40 files) ← category-specific
  • using System; (40/40 files)
  • using System.IO; (40/40 files)
  • using Aspose.Imaging.ImageOptions; (38/40 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Svg; (19/40 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Bmp; (6/40 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Png; (5/40 files) ← category-specific
  • using Aspose.Imaging.Sources; (4/40 files) ← category-specific
  • using System.Diagnostics; (1/40 files)
  • using Aspose.Imaging.Brushes; (1/40 files) ← category-specific
  • using System.Threading.Tasks; (1/40 files)

Files in this folder

FileKey APIsDescription
load-an-svg-file-using-svgimage-class-and-configure-rasterization-dimensions-before-conversion.csPngOptions, SvgImage, SvgRasterizationOptionsLoad an SVG file using SvgImage class and configure rasterization dimensions bef...
save-the-loaded-svg-as-a-bmp-file-with-custom-width-and-height-settings.csBmpOptionsSave the loaded SVG as a BMP file with custom width and height settings.
save-the-loaded-svg-as-a-png-file-using-default-rasterization-options.csPngOptions, SvgImage, SvgRasterizationOptionsSave the loaded SVG as a PNG file using default rasterization options.
render-svg-to-bmp-with-white-background-color-defined-in-svgrasterizationoptions.csBmpOptions, SvgRasterizationOptionsRender SVG to BMP with white background color defined in SvgRasterizationOptions...
render-svg-to-png-with-transparent-background-by-disabling-background-color-in-options.csPngOptions, SvgImage, SvgRasterizationOptionsRender SVG to PNG with transparent background by disabling background color in o...
enable-anti-aliasing-in-svgrasterizationoptions-before-saving-svg-to-bmp-for-smoother-edges.csBmpOptions, SvgImage, SvgRasterizationOptionsEnable anti‑aliasing in SvgRasterizationOptions before saving SVG to BMP for smo...
disable-anti-aliasing-in-svgrasterizationoptions-before-saving-svg-to-png-to-improve-performance.csPngOptions, SvgImage, SvgRasterizationOptionsDisable anti‑aliasing in SvgRasterizationOptions before saving SVG to PNG to imp...
save-converted-bmp-image-into-a-memorystream-for-further-in-memory-processing.csBmpOptionsSave converted BMP image into a MemoryStream for further in‑memory processing.
save-converted-png-image-into-a-memorystream-and-return-the-stream-to-the-caller.csPngOptionsSave converted PNG image into a MemoryStream and return the stream to the caller...
resize-bmp-raster-image-to-half-its-original-dimensions-after-conversion.csResize BMP raster image to half its original dimensions after conversion.
crop-png-raster-image-to-a-centered-square-region-after-conversion.csRasterImageCrop PNG raster image to a centered square region after conversion.
rotate-bmp-raster-image-ninety-degrees-clockwise-after-svg-conversion.csBmpOptions, SvgRasterizationOptionsRotate BMP raster image ninety degrees clockwise after SVG conversion.
apply-grayscale-filter-to-png-raster-image-before-saving-the-output-file.csPngImageApply grayscale filter to PNG raster image before saving the output file.
batch-convert-multiple-svg-files-to-bmp-using-a-single-svgrasterizationoptions-instance.csBmpOptions, SvgRasterizationOptionsBatch convert multiple SVG files to BMP using a single SvgRasterizationOptions i...
batch-convert-multiple-svg-files-to-png-while-reusing-the-same-rasterization-options.csPngOptions, SvgRasterizationOptionsBatch convert multiple SVG files to PNG while reusing the same rasterization opt...
implement-a-using-block-to-ensure-proper-disposal-of-svgimage-and-option-objects.csSvgImage, SvgOptions, SvgRasterizationOptionsImplement a using block to ensure proper disposal of SvgImage and option objects...
catch-exceptions-during-svg-loading-and-log-error-details-for-troubleshooting.csPngOptions, SvgRasterizationOptionsCatch exceptions during SVG loading and log error details for troubleshooting.
catch-exceptions-during-svg-saving-and-record-file-path-and-exception-message.csSvgOptionsCatch exceptions during SVG saving and record file path and exception message.
log-conversion-duration-in-milliseconds-and-output-file-size-after-each-svg-rasterization.csPngOptions, SvgRasterizationOptionsLog conversion duration in milliseconds and output file size after each SVG rast...
integrate-svg-to-bmp-conversion-into-an-asp-net-core-controller-action-returning-a-fileresult.csBmpOptions, VectorRasterizationOptionsIntegrate SVG to BMP conversion into an ASP.NET Core controller action returning...
create-an-asp-net-api-endpoint-that-accepts-uploaded-svg-and-returns-converted-png-as-file.csPngOptions, SvgRasterizationOptionsCreate an ASP.NET API endpoint that accepts uploaded SVG and returns converted P...
upload-an-svg-via-iformfile-convert-to-bmp-and-store-result-in-azure-blob-storage.csBmpOptionsUpload an SVG via IFormFile, convert to BMP, and store result in Azure Blob stor...
upload-an-svg-via-iformfile-convert-to-png-and-upload-result-to-amazon-s3-bucket.csPngOptions, SvgImage, SvgRasterizationOptionsUpload an SVG via IFormFile, convert to PNG, and upload result to Amazon S3 buck...
convert-svg-to-bmp-with-300-dpi-resolution-by-setting-bmpoptions-resolution-properties.csBmpOptions, VectorRasterizationOptionsConvert SVG to BMP with 300 DPI resolution by setting BmpOptions resolution prop...
convert-svg-to-png-with-transparent-background-by-leaving-background-color-undefined.csPngOptions, SvgImage, SvgRasterizationOptionsConvert SVG to PNG with transparent background by leaving background color undef...
convert-svg-to-bmp-using-an-indexed-color-palette-defined-in-bmpoptions.csBmpOptions, SvgRasterizationOptionsConvert SVG to BMP using an indexed color palette defined in BmpOptions.
convert-svg-to-png-with-high-compression-by-setting-pngoptions-compressionlevel-to-maximum.csPngOptions, SvgRasterizationOptionsConvert SVG to PNG with high compression by setting PngOptions.CompressionLevel ...
set-custom-page-width-and-height-in-svgrasterizationoptions-before-converting-svg-to-raster-image.csPngOptions, SvgImage, SvgRasterizationOptionsSet custom page width and height in SvgRasterizationOptions before converting SV...
specify-page-size-in-inches-using-svgrasterizationoptions-to-control-svg-raster-output-dimensions.csPngOptions, SvgRasterizationOptionsSpecify page size in inches using SvgRasterizationOptions to control SVG raster ...
set-background-color-to-white-in-svgrasterizationoptions-before-saving-svg-as-bmp.csBmpOptions, SvgImage, SvgRasterizationOptionsSet background color to white in SvgRasterizationOptions before saving SVG as BM...
...and 10 more filesView all

Category Statistics

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

Key API Surface

  • BmpImage
  • BmpOptions
  • Graphics
  • Html5CanvasOptions
  • PdfOptions
  • PngImage
  • PngOptions
  • RasterImage
  • SolidBrush
  • SvgImage
  • SvgOptions
  • SvgRasterizationOptions
  • VectorRasterizationOptions

Failed Tasks

All tasks passed ✅

Use Cases

  • A web service needs to generate thumbnail previews of user‑uploaded SVG logos, converting each SVG to PNG C# on the fly for fast display in browsers.
  • An automated reporting tool rasterizes complex vector charts to PNG files using SVG rasterization dotnet, ensuring consistent rendering across all Windows machines.
  • A desktop publishing application converts SVG icons to raster assets at various DPI levels, enabling vector to raster C# workflows for high‑resolution print output.
  • A CI/CD pipeline validates design assets by programmatically turning SVG mockups into PNG images, then comparing pixel differences to catch rendering issues early.
  • An e‑learning platform creates rasterized versions of SVG diagrams for inclusion in PDF course materials, leveraging SVG to PNG C# conversion to maintain visual fidelity.

Related Categories

The Convert SVG to Raster Images examples complement the Convert Raster to Vector and Image Format Conversion sections, where you can see how raster sources are transformed back into scalable formats or switched between common bitmap types. If you need to manipulate colors, apply filters, or resize images after rasterization, the Image Manipulation category provides ready‑to‑use snippets that integrate smoothly with the raster output. Together, these groups give a full pipeline—from vector creation to raster rendering and subsequent bitmap processing—tailored for .NET developers working with Aspose.Imaging.

Operations Covered

  • Add text watermark to BMP after SVG rasterization
  • Batch convert multiple SVG files to BMP using shared raster options
  • Handle exceptions while loading SVG and log error details
  • Convert SVG to 8‑bit indexed BMP with a custom palette
  • Convert SVG to PNG with maximum compression level
  • Load an uploaded SVG and return converted PNG via API endpoint
  • Disable anti‑aliasing in SVG rasterization to improve performance
  • Reuse a single SvgRasterizationOptions instance for several conversions

Supported Formats

  • SVG – source vector image loaded for rasterization
  • BMP – raster output format (including 8‑bit indexed BMP)
  • PNG – raster output format (including high‑compression PNG)

API Classes Used

  • Image — base class for loading and saving images of any supported format.
  • SvgRasterizationOptions — defines rasterization settings (size, background, anti‑aliasing, etc.) for converting SVG to raster images.
  • BmpOptions — specifies BMP‑specific saving options such as bits per pixel and custom palette.
  • PngOptions — specifies PNG‑specific saving options, including compression level.
  • Brushes — provides brush objects (e.g., solid color) used when drawing text watermarks.
  • FileFormats.Bmp.BmpPalette — represents a custom color palette applied to an indexed BMP.
  • Image.Load(string, LoadOptions) — loads an image (e.g., SVG) with optional load settings.
  • Image.Save(string, ImageOptionsBase) — saves the loaded image to the specified path using the given options.

Get Started

Ready to try Convert Svg To Raster Images conversions on your own files with Aspose.Imaging for .NET?

dotnet add package Aspose.Imaging
ResourceLink
📖 Documentationdocs.aspose.com/imaging/net
📦 NuGet Packagenuget.org/packages/Aspose.Imaging
🚀 Release Notesreleases.aspose.com/imaging/net
🌐 Online Appsproducts.aspose.app/imaging
🔑 Free Temporary Licensepurchase.aspose.com/temporary-license
🤝 Consulting (paid implementation help)consulting.aspose.com
<!-- AUTOGENERATED:START -->

Updated: 2026-09-16 | Run: 20260626_071457 | Examples: 40

<!-- AUTOGENERATED:END -->

Developer Q&A

Q: How can I add a text watermark to a BMP image after converting an SVG using Aspose.Imaging in C#?

Use Aspose.Imaging’s BmpImage to load the rasterized BMP and draw the watermark with Graphics and Brushes.SolidBrush. → See: add-a-watermark-text-to-bmp-image-after-svg-rasterization-using-drawing-api.cs

Q: What is the best way to batch‑convert many SVG files to PNG while reusing the same rasterization settings in Aspose.Imaging for .NET?

Create a single SvgRasterizationOptions object and assign it to each PngOptions before calling Image.Save. → See: batch-convert-multiple-svg-files-to-png-while-reusing-the-same-rasterization-options.cs

Q: How do I convert an SVG to an 8‑bit indexed BMP with a custom palette using Aspose.Imaging in C#?

Configure BmpOptions with BitsPerPixel = 8 and a custom Palette, then save the loaded SVG via Image.Save. → See: convert-svg-to-bmp-using-an-indexed-color-palette-defined-in-bmpoptions.cs

Q: How can I disable anti‑aliasing for faster SVG‑to‑PNG conversion with Aspose.Imaging?

Set SvgRasterizationOptions.AntiAliasing = false before saving the image with PngOptions. → See: disable-anti-aliasing-in-svgrasterizationoptions-before-saving-svg-to-png-to-improve-performance.cs

Q: How do I asynchronously load an SVG and save it as PNG without blocking the UI in a .NET application using Aspose.Imaging?

Use await Image.LoadAsync to read the SVG and then await image.SaveAsync with PngOptions. → See: implement-asynchronous-svg-loading-and-png-saving-using-async-await-pattern-for-non-blocking-i-o.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.