You are here: GdPicture.NET > Documentation > Classes > GdPictureImaging Class > GdPictureImaging Methods > Saving GdPicture Image > SaveAsByteArray Method
logo.gif
ContentsIndexHome
PreviousUpNext
GdPictureImaging.SaveAsByteArray Method

Saves a GdPicture image to a byte array.

C#
public GdPictureStatus SaveAsByteArray(
    int ImageID, 
    ref Byte arBytes, 
    ref int BytesRead, 
    DocumentFormat ImageFormat, 
    int EncoderParameter
);
Visual Basic
Public Function SaveAsByteArray(
    ByVal ImageID As Integer, 
    ByRef arBytes() As Byte, 
    ByRef BytesRead As Integer, 
    ByVal ImageFormat As DocumentFormat, 
    ByVal EncoderParameter As Integer
) As GdPictureStatus
Parameters
Parameters 
Description 
ImageID 
GdPicture Image Identifier.  
arBytes 
Output parameter. a GdPicture image data saved to a byte array.  
BytesRead 
Output parameter. The number of bytes wrote into the arBytes() array.  
ImageFormat 
A member of the DocumentFormat enumeration.
Currently supported format are:
- DocumentFormatBMP,
- DocumentFormatJPEG,
- DocumentFormatPNG,
- DocumentFormatTIFF (single page & editable multipage tiff image),
- DocumentFormatGIF. 
EncoderParameter 
Compression or encoding quality to use.
- For JPEG format defines the quality between 1 (lower) and 100 (higher).
- For TIFF format defines the compression scheme to be used: 6 for None, 5 for RLE, 4 for CCITT4, 3 for CCITT3, 2 for LZW and 65536 for automatic compression adjustment (recommended !).
- Use 0 for other image format.  
Returns

A member of the GdPictureStatus enumeration.

Saving an image into an array of bytes

Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("test.tif")
Dim ImageBytes As Byte() = Nothing
Dim BytesRead As Integer
 
oGdPictureImaging.SaveAsByteArray(ImageID, ImageBytes, BytesRead, DocumentFormat.DocumentFormatJPEG, 75)
What do you think about this topic? Send feedback!
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.