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

agentic-net-examples / convert-raster-image

AGENTS.md1 starsChanged 7 months agoMITView on GitHub

C# examples for Convert Raster Image 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, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create SVG from PNG and set black stroke color

    line 131
  2. Distinctive:

    Create SVG from BMP and set custom stroke width

    line 132
  3. Very specific:

    Use RasterImage to load the JPEG and call its Resize method with new Size(800, 600) while setting ResampleFilter to ResampleFilter.Lanczos.

    line 178
  4. Very specific:

    Create a PdfOptions object and pass it to image.Save(outputPath, pdfOptions) after resizing the image.

    line 181

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

Persona

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

Required Namespaces

  • using Aspose.Imaging; (139/139 files) ← category-specific
  • using System; (138/139 files)
  • using System.IO; (138/139 files)
  • using Aspose.Imaging.ImageOptions; (122/139 files) ← category-specific
  • using Aspose.Imaging.ImageFilters.FilterOptions; (38/139 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Svg; (36/139 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Svg.Graphics; (14/139 files) ← category-specific
  • using Aspose.Imaging.Brushes; (7/139 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Bmp; (7/139 files) ← category-specific
  • using Aspose.Imaging.Shapes; (5/139 files) ← category-specific
  • using Aspose.Imaging.Sources; (5/139 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Pdf; (4/139 files) ← category-specific
  • using Aspose.Imaging.FileFormats.Png; (3/139 files) ← category-specific
  • using System.Threading.Tasks; (2/139 files)
  • using Aspose.Imaging.FileFormats; (1/139 files) ← category-specific
  • using System.IO.Compression; (1/139 files)
  • using System.Xml.Linq; (1/139 files)
  • using System.Collections.Generic; (1/139 files)

Files in this folder

FileKey APIsDescription
load-a-bmp-file-apply-a-median-filter-and-save-the-result-as-a-pdf-file.csMedianFilterOptions, PdfOptions, RasterImageLoad a BMP file, apply a median filter, and save the result as a PDF file.
resize-a-png-image-to-1024-by-768-pixels-then-export-it-directly-to-pdf-format.csPdfOptionsResize a PNG image to 1024 by 768 pixels, then export it directly to PDF format.
crop-a-raster-image-to-a-central-square-region-before-converting-it-into-an-svg-document.csRasterImage, SvgOptionsCrop a raster image to a central square region before converting it into an SVG ...
load-multiple-bmp-files-from-a-directory-batch-convert-each-to-pdf-and-save-with-original-filenames.csPdfOptionsLoad multiple BMP files from a directory, batch convert each to PDF, and save wi...
create-an-svgimage-from-a-png-source-set-background-color-and-save-as-an-svg-file.csSvgImage, SvgOptionsCreate an SvgImage from a PNG source, set background color, and save as an SVG f...
apply-a-gaussian-blur-filter-to-a-raster-image-then-convert-the-filtered-image-to-pdf.csGaussianBlurFilterOptions, PdfOptions, RasterImageApply a Gaussian blur filter to a raster image, then convert the filtered image ...
load-a-generic-raster-image-resize-it-proportionally-and-export-the-resized-version-to-svg-format.csSvgOptionsLoad a generic raster image, resize it proportionally, and export the resized ve...
convert-a-bmp-image-to-pdf-using-image-save-with-exportformats-pdf-enumeration-for-explicit-format-control.csPdfOptionsConvert a BMP image to PDF using Image.Save with ExportFormats.Pdf enumeration f...
read-a-png-file-apply-a-sharpening-filter-and-write-the-output-to-a-memorystream-as-pdf.csPdfOptions, RasterImage, SharpenFilterOptionsRead a PNG file, apply a sharpening filter, and write the output to a MemoryStre...
load-a-raster-image-crop-the-top-left-quadrant-and-save-the-cropped-area-as-an-svg-file.csRasterImage, SvgOptionsLoad a raster image, crop the top-left quadrant, and save the cropped area as an...
batch-process-png-images-resizing-each-to-500x500-pixels-before-converting-all-to-individual-pdf-documents.csPdfOptionsBatch process PNG images, resizing each to 500x500 pixels before converting all ...
create-an-svgimage-from-a-raster-source-define-custom-viewbox-dimensions-and-save-the-svg-output.csRasterImageCreate an SvgImage from a raster source, define custom viewbox dimensions, and s...
read-bmp-files-from-a-share-convert-each-to-pdf-and-stream-the-pdfs-back-to-the-client.csPdfOptionsRead BMP files from a share, convert each to PDF, and stream the PDFs back to th...
load-a-raster-image-apply-a-median-filter-resize-to-thumbnail-size-and-save-as-svg.csMedianFilterOptions, RasterImage, SvgOptionsLoad a raster image, apply a median filter, resize to thumbnail size, and save a...
load-a-raster-image-perform-a-color-inversion-operation-and-export-the-inverted-image-as-a-pdf.csPdfOptions, RasterImageLoad a raster image, perform a color inversion operation, and export the inverte...
resize-a-png-image-using-high-quality-bicubic-interpolation-before-saving-it-as-an-svg-file.csSvgOptionsResize a PNG image using high‑quality bicubic interpolation before saving it as ...
create-an-svgimage-from-a-bmp-set-stroke-width-for-vector-paths-and-save-the-customized-svg.csRasterImageCreate an SvgImage from a BMP, set stroke width for vector paths, and save the c...
load-multiple-raster-images-apply-a-uniform-resize-to-1024x1024-and-batch-save-them-as-individual-svg-files.csSvgOptions, SvgRasterizationOptionsLoad multiple raster images, apply a uniform resize to 1024x1024, and batch save...
convert-a-bmp-image-to-pdf-and-write-the-pdf-directly-to-an-http-response-stream.csPdfOptionsConvert a BMP image to PDF and write the PDF directly to an HTTP response stream...
batch-process-images-in-a-folder-converting-each-raster-file-to-svg-while-preserving-original-filenames.csSvgOptions, SvgRasterizationOptionsBatch process images in a folder, converting each raster file to SVG while prese...
load-a-raster-image-apply-a-median-filter-then-convert-and-embed-the-result-into-a-pdf-page.csMedianFilterOptions, PdfOptions, RasterImageLoad a raster image, apply a median filter, then convert and embed the result in...
resize-a-bmp-image-to-half-its-original-dimensions-and-export-the-downsized-image-as-an-svg-file.csSvgOptions, SvgRasterizationOptionsResize a BMP image to half its original dimensions and export the downsized imag...
load-a-raster-image-perform-a-center-crop-of-400x400-pixels-and-save-the-cropped-area-as-pdf.csPdfOptionsLoad a raster image, perform a center crop of 400x400 pixels, and save the cropp...
batch-convert-png-images-to-pdf-using-a-shared-memorystream-to-collect-all-pdfs-for-zip-compression.csPdfOptionsBatch convert PNG images to PDF, using a shared MemoryStream to collect all PDFs...
resize-a-bmp-image-using-nearest-neighbor-interpolation-then-export-the-resized-image-as-an-svg-document.csSvgOptionsResize a BMP image using nearest‑neighbor interpolation, then export the resized...
batch-process-a-folder-of-pngs-applying-a-median-filter-and-converting-each-filtered-image-to-pdf.csMedianFilterOptions, PdfOptions, RasterImageBatch process a folder of PNGs, applying a median filter and converting each fil...
load-a-raster-image-set-its-background-to-transparent-and-export-it-as-an-svg-with-background-fill.csSvgOptions, SvgRasterizationOptionsLoad a raster image, set its background to transparent, and export it as an SVG ...
load-a-raster-image-apply-a-gaussian-blur-resize-to-200x200-and-export-as-pdf-for-thumbnail-preview.csGaussianBlurFilterOptions, PdfOptions, RasterImageLoad a raster image, apply a Gaussian blur, resize to 200x200, and export as PDF...
batch-convert-bmp-images-to-pdf-naming-each-output-file-with-a-timestamp-prefix-for-uniqueness.csPdfOptionsBatch convert BMP images to PDF, naming each output file with a timestamp prefix...
load-a-png-convert-it-to-an-svgimage-set-viewbox-to-match-original-dimensions-and-save-the-svg.csLoad a PNG, convert it to an SvgImage, set viewbox to match original dimensions,...
...and 109 more filesView all

Category Statistics

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

Key API Surface

  • BmpImage
  • BmpOptions
  • ConvolutionFilterOptions
  • GaussianBlurFilterOptions
  • Graphics
  • JpegImage
  • JpegOptions
  • LinearGradientBrush
  • LoadOptions
  • MaskingOptions
  • MedianFilterOptions
  • OtgRasterizationOptions
  • PdfOptions
  • PngImage
  • PngOptions
  • RasterCachedImage
  • RasterImage
  • SharpenFilterOptions
  • SolidBrush
  • SvgImage
  • SvgOptions
  • SvgRasterizationOptions
  • VectorRasterizationOptions

Failed Tasks

All tasks passed ✅

Use Cases

  • A web service needs to accept user‑uploaded photos and store them as PNG bitmaps; the raster image conversion C# examples show how to read JPEG or BMP files and perform a bitmap conversion dotnet before saving.
  • An automated reporting tool generates charts as BMP files and must embed them into PDF documents, requiring raster image conversion C# code to convert the bitmap to a high‑resolution PNG.
  • A desktop application processes scanned documents and needs to normalize all pages to a single raster format, using the bitmap conversion dotnet snippets to transform TIFF or GIF inputs into a consistent PNG output.
  • A game development pipeline imports legacy sprite sheets in various raster formats and needs to batch‑convert them to a uniform bitmap for Unity, leveraging the raster image conversion C# examples for fast, programmatic conversion.
  • An e‑commerce platform creates product thumbnails on the fly; the bitmap conversion dotnet examples demonstrate how to resize and convert incoming JPEG images to optimized WebP raster files for faster page loads.

Related Categories

The Convert Raster Image category works hand‑in‑hand with the Image Format Conversion examples, where you’ll find additional code for switching between JPEG, PNG, TIFF, and WebP beyond simple bitmap handling. If you need to change image dimensions after conversion, the Image Resizing agents provide seamless integration with the raster conversion workflow. For projects that require applying visual effects after a bitmap conversion, the Image Filtering agents offer filters and adjustments that can be chained directly after the conversion step. Together, these neighboring categories give you a complete toolkit for end‑to‑end image processing in .NET.

Operations Covered

  • Apply Gaussian blur to PNG images
  • Apply Gaussian blur to BMP images
  • Convert blurred raster image to PDF
  • Batch convert PNG files to PDF with sequential naming
  • Resize BMP images to 800 × 800 pixels
  • Apply sharpening filter to BMP images
  • Convert BMP image to PDF using explicit format enumeration
  • Create SVG from PNG and set black stroke color
  • Create SVG from BMP and set custom stroke width

Supported Formats

  • PNG – source raster format for blur, batch conversion, and SVG creation
  • BMP – source raster format for blur, resize, sharpen, and PDF conversion
  • PDF – target format for saving processed raster images
  • SVG – target vector format generated from PNG or BMP sources

API Classes Used

  • Image — static class that loads and saves images from/to files.
  • RasterImage — represents a raster image (e.g., PNG, BMP) and provides pixel‑level operations.
  • GaussianBlurFilterOption — defines the radius and sigma for a Gaussian blur filter.
  • SharpenFilterOption — defines parameters for a sharpening filter (used in BMP batch processing).
  • PdfOptions — options object that controls how a raster image is exported to PDF.
  • ExportFormats — enumeration that includes Pdf for explicit format selection when calling Save.
  • SvgImage — creates an SVG document from a raster source.
  • SvgGraphics — drawing surface used to render shapes and strokes into an SVG image.
  • SolidBrush — defines a solid fill color (used for setting stroke color to black).
  • RectangleShape (from Aspose.Imaging.Shapes) — represents a rectangular shape with customizable stroke width.
  • File / Directory (System.IO) — used to verify file existence and ensure output directories exist.

Get Started

Ready to try Convert Raster Image 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_070336 | Examples: 139

<!-- AUTOGENERATED:END -->

Developer Q&A

Q: How can I resize a JPEG to 800x600 using Lanczos resampling in C# with Aspose.Imaging?

Use RasterImage to load the JPEG and call its Resize method with new Size(800, 600) while setting ResampleFilter to ResampleFilter.Lanczos. → See: resize-a-raster-image-using-lanczos-resampling-then-convert-the-high-quality-result-to-pdf.cs

Q: How do I convert a resized raster image to PDF in C# using Aspose.Imaging?

Create a PdfOptions object and pass it to image.Save(outputPath, pdfOptions) after resizing the image. → See: resize-a-raster-image-using-lanczos-resampling-then-convert-the-high-quality-result-to-pdf.cs

Q: Which Aspose.Imaging class provides Lanczos resampling for image resizing in .NET?

The ResampleFilter enumeration includes Lanczos, which you supply to the Resize method of a RasterImage. → See: resize-a-raster-image-using-lanczos-resampling-then-convert-the-high-quality-result-to-pdf.cs

Q: How should I handle exceptions when resizing and converting images with Aspose.Imaging in C#?

Wrap the processing code in a try‑catch block and catch Exception (or ImageProcessingException) to capture any errors from Aspose.Imaging operations. → See: resize-a-raster-image-using-lanczos-resampling-then-convert-the-high-quality-result-to-pdf.cs

Q: Can I resize a JPEG and directly save it as PDF without creating an intermediate file using Aspose.Imaging for .NET?

Yes—load the JPEG into a RasterImage, resize it, then call Save with a PdfOptions instance to output the PDF in a single step. → See: resize-a-raster-image-using-lanczos-resampling-then-convert-the-high-quality-result-to-pdf.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.