agentic-net-examples / convert-dicom-images
AGENTS.md1 starsChanged 7 months agoMITView on GitHub
C# examples for Convert DICOM 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 code style.
Of the AGENTS.md files we read, the 33,398 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 repository18 other files it gives its agents.
- aspose-imaging-examplesAGENTS.md
- conversionAGENTS.md
- convert-apngAGENTS.md
- convert-cdrAGENTS.md
- convert-cmx-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
- release-notes/agents.mdAGENTS.md
- working-with-drawing-imagesAGENTS.md
The file
We split this agents.md into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is 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.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 92
When you need to turn a grayscale DICOM scan into a PNG with a specific colour map, you can apply a custom palette during the conversion …
- Distinctive: line 93
If you have a folder full of DICOM files and must output PNGs that keep the original filenames, a simple batch‑convert loop lets you …
- Very specific: line 95
When a DICOM image arrives as a byte array (for example from a web API), you can convert it to PNG entirely in memory by loading the bytes …
- Distinctive: line 99
If you’re also working with other medical image formats, the Conversion category shows how to move between generic raster types, which can …
- Distinctive: line 101
When your workflow involves converting the resulting PNGs to other raster formats (e.g., JPEG or TIFF), the Convert Raster Image category …
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 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 - Convert DICOM Images
Persona
You are a C# developer specializing in image processing using Aspose.Imaging for .NET, working within the Convert DICOM Images category. This folder contains standalone C# examples for Convert DICOM Images operations. See the root agents.md for repository-wide conventions and boundaries.
Required Namespaces
using System;(30/30 files)using System.IO;(30/30 files)using Aspose.Imaging.ImageOptions;(30/30 files) ← category-specificusing Aspose.Imaging;(27/30 files) ← category-specificusing Aspose.Imaging.FileFormats.Dicom;(16/30 files) ← category-specificusing Aspose.Imaging.FileFormats.Png;(5/30 files) ← category-specificusing Aspose.Imaging.Sources;(4/30 files) ← category-specificusing System.Threading;(2/30 files)using System.Linq;(1/30 files)using System.Threading.Tasks;(1/30 files)
Files in this folder
| File | Key APIs | Description |
| load-a-dicom-file-from-disk-and-save-it-as-a-png-using-a-single-api-call.cs | PngOptions | Load a DICOM file from disk and save it as a PNG using a single API call. |
| convert-a-dicom-image-stored-in-a-byte-array-to-png-by-using-memorystream-for-in-memory-processing.cs | DicomImage, PngOptions | Convert a DICOM image stored in a byte array to PNG by using MemoryStream for in... |
| use-the-image-isvalid-property-to-verify-dicom-file-integrity-before-attempting-png-conversion.cs | PngOptions | Use the Image.IsValid property to verify DICOM file integrity before attempting ... |
| apply-a-median-filter-to-a-dicom-image-before-converting-it-to-png-to-reduce-noise.cs | DicomImage, PngOptions | Apply a median filter to a DICOM image before converting it to PNG to reduce noi... |
| resize-a-dicom-image-to-specific-dimensions-prior-to-png-conversion-using-the-image-resize-method.cs | DicomImage, PngOptions | Resize a DICOM image to specific dimensions prior to PNG conversion using the Im... |
| rotate-a-dicom-image-90-degrees-clockwise-before-saving-it-as-a-png-file.cs | DicomImage, PngOptions | Rotate a DICOM image 90 degrees clockwise before saving it as a PNG file. |
| set-the-png-color-type-to-truecolor-during-conversion-to-preserve-full-color-information-from-dicom.cs | PngOptions | Set the PNG color type to truecolor during conversion to preserve full color inf... |
| configure-png-compression-level-in-pngoptions-to-balance-file-size-and-image-quality-during-conversion.cs | PngOptions | Configure PNG compression level in PngOptions to balance file size and image qua... |
| iterate-through-each-frame-of-a-multi-page-dicom-and-export-every-frame-as-an-individual-png-file.cs | DicomImage, PngOptions | Iterate through each frame of a multi‑page DICOM and export every frame as an in... |
| batch-convert-all-dicom-files-in-a-directory-to-png-format-while-preserving-original-filenames.cs | PngOptions | Batch convert all DICOM files in a directory to PNG format while preserving orig... |
| implement-progress-reporting-for-batch-conversion-of-dicom-files-to-png-using-iprogress-interface.cs | PngOptions | Implement progress reporting for batch conversion of DICOM files to PNG using IP... |
| implement-a-retry-mechanism-that-attempts-dicom-to-png-conversion-up-to-three-times-on-transient-errors.cs | PngOptions | Implement a retry mechanism that attempts DICOM to PNG conversion up to three ti... |
| implement-exception-handling-to-gracefully-skip-corrupted-dicom-files-during-batch-png-conversion.cs | PngOptions | Implement exception handling to gracefully skip corrupted DICOM files during bat... |
| capture-and-log-aspose-imaging-exceptions-when-a-dicom-to-png-conversion-fails-due-to-corrupted-data.cs | DicomImage, PngOptions | Capture and log Aspose.Imaging exceptions when a DICOM to PNG conversion fails d... |
| use-a-using-statement-to-ensure-the-image-object-is-disposed-after-converting-dicom-to-png.cs | PngOptions | Use a using statement to ensure the Image object is disposed after converting DI... |
| save-the-resulting-png-image-to-a-memorystream-for-further-transmission-over-a-network.cs | PngOptions | Save the resulting PNG image to a MemoryStream for further transmission over a n... |
| validate-that-the-pixel-data-remains-unchanged-after-converting-a-dicom-image-to-png-format.cs | PngOptions, RasterImage | Validate that the pixel data remains unchanged after converting a DICOM image to... |
| validate-that-the-generated-png-files-are-viewable-in-standard-image-viewers-after-conversion.cs | PngOptions | Validate that the generated PNG files are viewable in standard image viewers aft... |
| implement-asynchronous-dicom-to-png-conversion-using-task-run-to-avoid-blocking-the-ui-thread.cs | PngOptions | Implement asynchronous DICOM to PNG conversion using Task.Run to avoid blocking ... |
| create-a-command-line-tool-that-accepts-a-dicom-file-path-and-outputs-a-png-file-to-a-folder.cs | DicomImage, PngOptions | Create a command‑line tool that accepts a DICOM file path and outputs a PNG file... |
| develop-a-unit-test-that-loads-a-sample-dicom-converts-it-to-png-and-compares-file-sizes.cs | DicomImage, PngOptions | Develop a unit test that loads a sample DICOM, converts it to PNG, and compares ... |
| integrate-dicom-to-png-conversion-into-an-asp-net-core-api-endpoint-returning-the-png-as-a-byte-array.cs | DicomImage, PngOptions | Integrate DICOM to PNG conversion into an ASP.NET Core API endpoint returning th... |
| create-a-windows-forms-application-that-allows-users-to-select-dicom-files-and-view-generated-png-previews.cs | DicomImage, PngOptions | Create a Windows Forms application that allows users to select DICOM files and v... |
| write-a-powershell-script-that-invokes-the-net-conversion-library-to-process-dicom-files-in-bulk.cs | DicomImage, PngOptions | Write a PowerShell script that invokes the .NET conversion library to process DI... |
| configure-the-png-output-to-include-metadata-from-the-original-dicom-file-for-traceability.cs | DicomImage, PngOptions | Configure the PNG output to include metadata from the original DICOM file for tr... |
| extract-the-patient-name-tag-from-dicom-metadata-and-embed-it-into-the-png-file-name.cs | DicomImage, PngOptions | Extract the patient name tag from DICOM metadata and embed it into the PNG file ... |
| apply-a-custom-color-palette-to-the-png-output-when-converting-grayscale-dicom-images.cs | DicomImage, PngOptions, RasterImage | Apply a custom color palette to the PNG output when converting grayscale DICOM i... |
| create-a-logging-wrapper-that-records-start-and-end-timestamps-for-each-dicom-to-png-conversion-operation.cs | DicomImage, PngOptions | Create a logging wrapper that records start and end timestamps for each DICOM to... |
| develop-a-background-service-that-monitors-a-folder-for-new-dicom-files-and-automatically-converts-them-to-png.cs | DicomImage, PngOptions | Develop a background service that monitors a folder for new DICOM files and auto... |
| document-the-conversion-process-in-code-comments-including-required-using-directives-and-disposal-patterns.cs | JpegOptions | Document the conversion process in code comments, including required using direc... |
Category Statistics
- Total examples: 30
- Failed: 0
- Pass rate: 100.0%
Key API Surface
ApngOptionsColorPaletteDicomImageDicomOptionsJpegOptionsLoadOptionsMedianFilterOptionsPngImagePngOptionsRasterImageTiffOptions
Failed Tasks
All tasks passed ✅
Use Cases
- When you need to turn a grayscale DICOM scan into a PNG with a specific colour map, you can apply a custom palette during the conversion using Aspose.Imaging for .NET.
- If you have a folder full of DICOM files and must output PNGs that keep the original filenames, a simple batch‑convert loop lets you preserve naming while processing each file.
- To reduce the size of PNGs generated from DICOM images, you can set the PNG compression level in
PngOptionsbefore saving, balancing file size against visual quality. - When a DICOM image arrives as a byte array (for example from a web API), you can convert it to PNG entirely in memory by loading the bytes into a
MemoryStreamand saving with Aspose.Imaging in C#. - For developers searching “how to convert DICOM to PNG with Aspose.Imaging for .NET”, the examples demonstrate the full workflow: load the DICOM, configure conversion options, and save as PNG.
Related Categories
If you’re also working with other medical image formats, the Conversion category shows how to move between generic raster types, which can be combined with DICOM‑to‑PNG pipelines.
For scenarios where you need to further process the PNG output—such as applying filters or adjusting colour balance—see the Image And Photo Filters examples that operate on the same Image objects.
When your workflow involves converting the resulting PNGs to other raster formats (e.g., JPEG or TIFF), the Convert Raster Image category provides ready‑to‑use code snippets that complement the DICOM conversion steps.
<!-- AUTOGENERATED:START -->Updated: 2026-11-16 | Run: 20261014_164648 | Examples: 30
<!-- AUTOGENERATED:END -->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.

