DicomImageSave Method (Stream, ImageOptionsBase, Rectangle)
Saves the image's data to the specified stream in the specified file format according to save options.

Namespace: Aspose.Imaging.FileFormats.Dicom
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 21.04
public override void Save(
	Stream stream,
	ImageOptionsBase optionsBase,
	Rectangle boundsRectangle


Type: System.IOStream
The stream to save the image's data to.
Type: Aspose.ImagingImageOptionsBase
The save options.
Type: Aspose.ImagingRectangle
The destination image bounds rectangle. Set the empty rectangle for use sourse bounds.
The following example loads a DICOM image from a file, then saves the image to a PNG file stream.

string dir = "c:\\temp\\";

using (Aspose.Imaging.FileFormats.Dicom.DicomImage image = (Aspose.Imaging.FileFormats.Dicom.DicomImage)Aspose.Imaging.Image.Load(dir + "sample.dicom"))
    Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
    Aspose.Imaging.Rectangle bounds = new Aspose.Imaging.Rectangle(0, 0, image.Width / 2, image.Height / 2);
    using (System.IO.Stream outputStream = System.IO.File.Open(dir + "output.png", System.IO.FileMode.Create))
        // Save the upper-left quarter of the image to a file stream.
        image.Save(outputStream, saveOptions, bounds);
See Also