DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomImage Class / Export Method / Export(Stream,ImageFormat,Int32) Method

The stream into which the image is written

The file format you would like to export image to

The quality factor to be used. An integer that specifies the value stored in the System.Drawing.Imaging.EncoderParameter object

Example

In This Topic
    Export(Stream,ImageFormat,Int32) Method
    In This Topic
    Export DicomImage to supported Image Format
    Syntax
    'Declaration
     
    
    Public Overloads Sub Export( _
       ByVal Stream As System.IO.Stream, _
       ByVal Format As System.Drawing.Imaging.ImageFormat, _
       ByVal Quality As System.Integer _
    ) 
    public void Export( 
       System.IO.Stream Stream,
       System.Drawing.Imaging.ImageFormat Format,
       System.int Quality
    )

    Parameters

    Stream

    The stream into which the image is written

    Format

    The file format you would like to export image to

    Quality

    The quality factor to be used. An integer that specifies the value stored in the System.Drawing.Imaging.EncoderParameter object

    Remarks
    This method provides a native .NET approach to export images. An internal BMP image is created and the .NET bmp.Save method is used. For more flexibility, it is possible to build your own export routine, by using DicomImage.Bitmap method to get a bitmap image out of the DicomImage then using the native .NET approaches to convert it to any format you like.
    Example
    DicomImage image = new DicomImage("your_dicom_image.dcm");
    ImageFormat format = ImageFormat.Jpeg;
    int quality = 90;
                
    // e.g. Export to disk
    using (FileStream fs = new FileStream("exported_image.jpg", FileMode.Create, FileAccess.Write))
    {
        image.Export(fs, format, quality);
    }
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also