CreateImageFromByteArrayICM Method

See Also     Examples     Applies To

Creates a new GdPicture Image from an image file stored within an array of bytes. This function uses embedded color management (ICM).

Syntax

object.CreateImageFromByteArrayICM (*arBytes())

The CreateImageFromByteArrayICM syntax has these parts:

Part Description
object Required. An object expression that evaluates to an object in the Applies To list.
*arBytes() Required. Input 1D Byte Array. Array which contains image file data.

Returns

Long.
0: The image could not created. Use the GetStat() function to determine the reason this function failed.
Non-zero: GdPicture Image handle. Handle of the created image.

Remarks

If success, set the created image as the native GdPicture image.
Supported formats are BMP, DIB, RLE, ICO, EMF, WMF, GIF, ANIMATED GIF, JPEG, JPG, JPE, JFIF, PNG, TIFF, MULTIPAGE TIFF, PNM, PPM, PBM, PFM, PGM, RPPM, RPGM, RPBM, PCX.
Redistributing the optional gdimgplug.dll library you will also be able to read XPM, XBM, WBMP, TGA, SGI, RAW, PICT, Sun RAS, PSD, MNG, Kodak PhotoCD files, KOALA files, JP2, J2K, JNG, JBIG, IFF, HDR, Raw Fax G3, EXR, DDS and Dr. Halo files.

Note for multipage images (TIFF and GIF):
By default, the class loads multipage images (GIF and TIFF) for reading and writing creating a GdPicture image marked as editable multipage.
However this way is a bit slower than creating a GdPicture image marked as non editable multipage.
If you want to open multipage images as read only, you should call the TiffOpenMultiPageAsReadOnly() function for tiff files or the GifOpenMultiPageAsReadOnly() function for gif files.

Category

Load, Import & Create an image

Visual Basic Sample

How to create an image from an array of bytes


Dim nPtFile As Integer
Dim arBuffer() As Byte
Dim nImageID As Long

nPtFile = FreeFile
Open "myimage.tif" For Binary As #nPtFile
ReDim arBuffer((LOF(nPtFile)))
Get #nPtFile, , arBuffer
Close #nPtFile

nImageID = object.CreateImageFromByteArrayICM(arBuffer)
Erase arBuffer






© Copyright 2008 GdPicture All rights reserved.
Documentation MAP.