GdPicture.NET Reference Guide
SaveAsByteArray Method (GdPictureImaging)





GdPicture14 Namespace > GdPictureImaging Class : SaveAsByteArray Method
GdPicture image identifier.
Output parameter. The image data.
Output parameter. The number of bytes wrote into the Data array.
A member of the DocumentFormat enumeration. Currently supported formats are:

DocumentFormatBMP.

DocumentFormatJPEG.

DocumentFormatPNG.

DocumentFormatTIFF.

DocumentFormatGIF.

DocumentFormatJ2K (JPEG2000 codestream).

DocumentFormatJP2 (JPEG2000)

DocumentFormatTARGA.

DocumentFormatEXR.

DocumentFormatWBMP.

DocumentFormatXPM.

DocumentFormatPBM.

DocumentFormatWMF.

DocumentFormatWEBP.

Compression or encoding quality to use.

For JPEG format: the parameter defines the quality between 1 (lower) and 100 (higher).

For WebP format: the parameter defines the quality between 1 (lower) and 100 (higher - lossless encoding).

For TIFF format: the parameter defines the compression scheme to be used: 1 for none, 2 for RLE, 3 for CCITT3, 4 for CCITT4, 5 for LZW, 7 for JPEG, 32946 for Deflate and 65536 for automatic compression adjustment. For more options the SaveAsTiff() method taking a Stream object as parameter can be used.

For JPEG2000 format: the parameter defines the compression rate Between [1(MaxQuality - Lossless) ... 512(Poor quality)]. Default value is 16.

For PNG format: the parameter defines the compression level Between [0(no compression - faster encoding) ... 9(max compression - slower encoding)]. Default value is 6.

For other formats use 0.

Saves a GdPicture image to a byte array. This methods can generate multipage tiff file if the input GdPicture image is an editable multipage tiff.
Syntax
'Declaration
 
Public Function SaveAsByteArray( _
   ByVal ImageID As Integer, _
   ByRef Data As Byte(), _
   ByRef Length As Integer, _
   ByVal ImageFormat As DocumentFormat, _
   ByVal EncoderParameter As Integer _
) As GdPictureStatus
public GdPictureStatus SaveAsByteArray( 
   int ImageID,
   ref byte[] Data,
   ref int Length,
   DocumentFormat ImageFormat,
   int EncoderParameter
)
public function SaveAsByteArray( 
    ImageID: Integer;
   var  Data: array of Byte;
   var  Length: Integer;
    ImageFormat: DocumentFormat;
    EncoderParameter: Integer
): GdPictureStatus; 
public function SaveAsByteArray( 
   ImageID : int,
   Data : byte[],
   Length : int,
   ImageFormat : DocumentFormat,
   EncoderParameter : int
) : GdPictureStatus;
public: GdPictureStatus SaveAsByteArray( 
   int ImageID,
   ref byte[] Data,
   ref int Length,
   DocumentFormat ImageFormat,
   int EncoderParameter
) 
public:
GdPictureStatus SaveAsByteArray( 
   int ImageID,
   array<byte>% Data,
   int% Length,
   DocumentFormat ImageFormat,
   int EncoderParameter
) 

Parameters

ImageID
GdPicture image identifier.
Data
Output parameter. The image data.
Length
Output parameter. The number of bytes wrote into the Data array.
ImageFormat
A member of the DocumentFormat enumeration. Currently supported formats are:

DocumentFormatBMP.

DocumentFormatJPEG.

DocumentFormatPNG.

DocumentFormatTIFF.

DocumentFormatGIF.

DocumentFormatJ2K (JPEG2000 codestream).

DocumentFormatJP2 (JPEG2000)

DocumentFormatTARGA.

DocumentFormatEXR.

DocumentFormatWBMP.

DocumentFormatXPM.

DocumentFormatPBM.

DocumentFormatWMF.

DocumentFormatWEBP.

EncoderParameter
Compression or encoding quality to use.

For JPEG format: the parameter defines the quality between 1 (lower) and 100 (higher).

For WebP format: the parameter defines the quality between 1 (lower) and 100 (higher - lossless encoding).

For TIFF format: the parameter defines the compression scheme to be used: 1 for none, 2 for RLE, 3 for CCITT3, 4 for CCITT4, 5 for LZW, 7 for JPEG, 32946 for Deflate and 65536 for automatic compression adjustment. For more options the SaveAsTiff() method taking a Stream object as parameter can be used.

For JPEG2000 format: the parameter defines the compression rate Between [1(MaxQuality - Lossless) ... 512(Poor quality)]. Default value is 16.

For PNG format: the parameter defines the compression level Between [0(no compression - faster encoding) ... 9(max compression - slower encoding)]. Default value is 6.

For other formats use 0.

Return Value

A member of the GdPictureStatus enumeration.
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
CreateGdPictureImageFromByteArray(Byte[]) Method