Visual Basic (Declaration) | |
---|---|
Public Overloads Sub Save( _ ByVal image As RasterImage, _ ByVal stream As Stream, _ ByVal format As RasterImageFormat, _ ByVal bitsPerPixel As Integer, _ ByVal firstPage As Integer, _ ByVal lastPage As Integer, _ ByVal firstSavePageNumber As Integer, _ ByVal pageMode As CodecsSavePageMode _ ) |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public void Save( RasterImage image, Stream stream, RasterImageFormat format, int bitsPerPixel, int firstPage, int lastPage, int firstSavePageNumber, CodecsSavePageMode pageMode ) |
C++/CLI | |
---|---|
public: void Save( RasterImage image, Stream^ stream, RasterImageFormat format, int bitsPerPixel, int firstPage, int lastPage, int firstSavePageNumber, CodecsSavePageMode pageMode ) |
Parameters
- image
- The RasterImage object that holds the image data.
- stream
- A Stream where the image data will be saved.
- format
- The output file format. For valid values, Summary of All Supported Image File Formats.
- bitsPerPixel
- Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Summary of All Supported Image File Formats. If bitsPerPixel is 0, the image will be stored using the closet bits/pixel value supported by that format. For example, if a file format supports 1, 4, and 24 bits/pixel, and RasterImage.BitsPerPixel is 5, the file will be stored as 24 bit. Likewise, if RasterImage.BitsPerPixel is 2, the file will be stored as 4 bit.
- firstPage
- 1-based index of the first page in image to save.
- lastPage
- 1-based index of the last page in image to save. Pass -1 to save from firstPage to the last page in image.
- firstSavePageNumber
- 1-based index of the first output page. If the output file already exists, then this parameter lets you control which pages to overwrite and/or where to append the new pages.
- pageMode
Determines how to handle the page when saving to multipage formats. This can be one of the following:
Value Meaning CodecsSavePageMode.Append Append the new page(s) to the end of the file. If the file does not exist, this option will create the file and add the pages to it. firstSavePageNumber is not used. CodecsSavePageMode.Insert Insert the new page(s) at the index specified by firstSavePageNumber. CodecsSavePageMode.Replace Replace the page(s) starting at the index specified by firstSavePageNumber. CodecsSavePageMode.Overwrite Overwrite the page(s) starting at the index specified by firstSavePageNumber. CodecsSavePageMode.Append Append the new page(s) to the end of the file. If the file does not exist, this option will create the file and add the pages to it.
This example will create a multipage image and save it to a stream before using the Save method to insert and replace pages directly in the file.
Visual Basic | Copy Code |
---|---|
Public Sub SaveStream2Example() |
C# | Copy Code |
---|---|
public void SaveStream2Example() |
If the image is 8 bits per pixel or greater, use the LEAD CMP format or one of the JPEG (JTIF or JFIF) formats to save disk space.
If the image is 1-bit per pixel, use the LEAD 1-bit format or a CCITT Group 3 or 4 format to save disk space.
If the image has a region, the region stored in the image will be saved, if the image is saved as one of the TIFF file formats. Note, however, that the ability to save a region inside a TIFF file must be unlocked. This requires a Document Imaging or Medical Imaging toolkit. /// For more information, refer to Saving A Region.
Only TIFF and DICOM file formats are capable of saving images that have been window-leveled. Images can be window-leveled by calling RasterImage.WindowLevel and specifying RasterWindowLevelMode.PaintAndProcessing, by using the WindowLevelCommand or by loading an image from a file format that supports Window Leveling. If a window-leveled image is saved as any other file format, the image data will be converted before being saved. For more information, refer to Saving Window-Leveled Images.
Use the CodecsSaveOptions class to set up other save options parameters before calling this method.
This method supports signed data images, but only DICOM and TIFF formats support signed data. This method will throw an exception if you attempt to save a signed image to a format other than DICOM or TIFF.
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family