Image Functions

Windows GDI+ exposes a flat API that consists of about 600 functions, which are implemented in Gdiplus.dll and declared in Gdiplusflat.h. The functions in the GDI+ flat API are wrapped by a collection of about 40 C++ classes. It is recommended that you do not directly call the functions in the flat API. Whenever you make calls to GDI+, you should do so by calling the methods and functions provided by the C++ wrappers. Microsoft Product Support Services will not provide support for code that calls the flat API directly. For more information on using these wrapper methods, see GDI+ Flat API.

The following flat API functions are wrapped by the Image C++ class.

HatchBrush Functions and Corresponding Wrapper Methods

Flat function Wrapper method Remarks
GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream* stream, GpImage **image)
Image::Image(IN IStream* stream, IN BOOL useEmbeddedColorManagement) Creates an Image object based on a stream.
This flat function does not use Image Color Management (ICM).
GpStatus WINGDIPAPI GdipLoadImageFromFile(GDIPCONST WCHAR* filename, GpImage **image)
Image::Image(IN const WCHAR* filename, IN BOOL useEmbeddedColorManagement) Creates an Image object based on a file.
This flat function does not use ICM.
GpStatus WINGDIPAPI GdipLoadImageFromStreamICM(IStream* stream, GpImage **image)
Image::Image(IN IStream* stream, IN BOOL useEmbeddedColorManagement) Creates an Image object based on a stream.
This flat function does not use ICM.
GpStatus WINGDIPAPI GdipLoadImageFromFileICM(GDIPCONST WCHAR* filename, GpImage **image)
Image::Image(IN const WCHAR* filename, IN BOOL useEmbeddedColorManagement) Creates an Image object based on a file.
This flat function does not use ICM.
GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
Image* Image::Clone() Creates a new Image object and initializes it with the contents of this Image object.
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Image::~Image()
Releases resources used by the Image object.
GpStatus WINGDIPAPI GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR* filename, GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams)
Status Image::Save( IN const WCHAR* filename, IN const CLSID* clsidEncoder, IN const EncoderParameters *encoderParams ) Saves this image to a file.
GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream, GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams)
Status Image::Save( IN IStream* stream, IN const CLSID* clsidEncoder, IN const EncoderParameters *encoderParams ) Saves this image to a stream.
GpStatus WINGDIPAPI GdipSaveAdd(GpImage *image, GDIPCONST EncoderParameters* encoderParams)
Status Image::SaveAdd( IN const EncoderParameters *encoderParams ) Adds a frame to a file or stream specified in a previous call to the Save method. Use this method to save selected frames from a multiple-frame image to another multiple-frame image.
GpStatus WINGDIPAPI GdipSaveAddImage(GpImage *image, GpImage* newImage, GDIPCONST EncoderParameters* encoderParams)
Status Image::SaveAdd( IN Image* newImage, IN const EncoderParameters *encoderParams ) Adds a frame to a file or stream specified in a previous call to the Save method.
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Graphics::Graphics(IN Image* image) Creates a Graphics object that is associated with an Image object.
GpStatus WINGDIPAPI GdipGetImageBounds(GpImage *image, GpRectF *srcRect, GpUnit *srcUnit)
Status Image::GetBounds( OUT RectF *srcRect, OUT Unit *srcUnit ) Gets the bounding rectangle for this image.
GpStatus WINGDIPAPI GdipGetImageDimension(GpImage *image, REAL *width, REAL *height)
Status Image::GetPhysicalDimension( OUT SizeF* size ) Gets the width and height of this image.
In the flat function, the width and height parameters together correspond to the size parameter in the wrapper method.
GpStatus WINGDIPAPI GdipGetImageType(GpImage *image, ImageType *type)
ImageType Image::GetType() const Gets the type (bitmap or metafile) of this Image object.
GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
UINT Image::GetWidth() Gets the width, in pixels, of this image.
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
UINT Image::GetHeight() Gets the image height, in pixels, of this image.
GpStatus WINGDIPAPI GdipGetImageHorizontalResolution(GpImage *image, REAL *resolution)
REAL Image::GetHorizontalResolution() Gets the horizontal resolution, in dots per inch, of this image.
GpStatus WINGDIPAPI GdipGetImageVerticalResolution(GpImage *image, REAL *resolution)
REAL Image::GetVerticalResolution() Gets the vertical resolution, in dots per inch, of this image.
GpStatus WINGDIPAPI GdipGetImageFlags(GpImage *image, UINT *flags)
UINT Image::GetFlags() Gets a set of flags that indicate certain attributes of this Image object.
GpStatus WINGDIPAPI GdipGetImageRawFormat(GpImage *image, GUID *format)
Status Image::GetRawFormat(OUT GUID *format) Gets a globally unique identifier ( GUID) that identifies the format of this Image object. GUIDs that identify various file formats are defined in Gdiplusimaging.h.
GpStatus WINGDIPAPI GdipGetImagePixelFormat(GpImage *image, PixelFormat *format)
PixelFormat Image::GetPixelFormat() Gets the pixel format of this Image object.
GpStatus WINGDIPAPI GdipGetImageThumbnail(GpImage *image, UINT thumbWidth, UINT thumbHeight, GpImage **thumbImage, GetThumbnailImageAbort callback, VOID * callbackData)
Image* Image::GetThumbnailImage( IN UINT thumbWidth, IN UINT thumbHeight, IN GetThumbnailImageAbort callback, IN VOID* callbackData ) Gets a thumbnail image from this Image object.
GpStatus WINGDIPAPI GdipGetEncoderParameterListSize(GpImage *image, GDIPCONST CLSID* clsidEncoder, UINT* size)
UINT Image::GetEncoderParameterListSize( IN const CLSID* clsidEncoder ) Gets the size, in bytes, of the parameter list for a specified image encoder.
GpStatus WINGDIPAPI GdipGetEncoderParameterList(GpImage *image, GDIPCONST CLSID* clsidEncoder, UINT size, EncoderParameters* buffer)
Status Image::GetEncoderParameterList( IN const CLSID* clsidEncoder, IN UINT size, OUT EncoderParameters* buffer ) Gets a list of the parameters supported by a specified image encoder.
GpStatus WINGDIPAPI GdipImageGetFrameDimensionsCount(GpImage* image, UINT* count)
UINT Image::GetFrameDimensionsCount() Gets the number of frame dimensions in this Image object.
GpStatus WINGDIPAPI GdipImageGetFrameDimensionsList(GpImage* image, GUID* dimensionIDs, UINT count)
Status Image::GetFrameDimensionsList( OUT GUID* dimensionIDs, IN UINT count ) Gets the identifiers for the frame dimensions of this Image object.
GpStatus WINGDIPAPI GdipImageGetFrameCount(GpImage *image, GDIPCONST GUID* dimensionID, UINT* count)
UINT Image::GetFrameCount( IN const GUID* dimensionID ) Gets the number of frames in a specified dimension of this Image object.
GpStatus WINGDIPAPI GdipImageSelectActiveFrame(GpImage *image, GDIPCONST GUID* dimensionID, UINT frameIndex)
Status Image::SelectActiveFrame( IN const GUID *dimensionID, IN UINT frameIndex ) Selects the frame in this Image object specified by a dimension and an index.
GpStatus WINGDIPAPI GdipImageRotateFlip(GpImage *image, RotateFlipType rfType)
Status Image::RotateFlip( IN RotateFlipType rotateFlipType ) Rotates and flips this image.
GpStatus WINGDIPAPI GdipGetImagePalette(GpImage *image, ColorPalette *palette, INT size)
Status Image::GetPalette( OUT ColorPalette *palette, IN INT size ) Gets the ColorPalette of this Image object.
GpStatus WINGDIPAPI GdipSetImagePalette(GpImage *image, GDIPCONST ColorPalette *palette)
Status Image::SetPalette( IN const ColorPalette *palette ) Sets the color palette of this Image object.
GpStatus WINGDIPAPI GdipGetImagePaletteSize(GpImage *image, INT *size)
INT Image::GetPaletteSize() Gets the size, in bytes, of the color palette of this Image object.
GpStatus WINGDIPAPI GdipGetPropertyCount(GpImage *image, UINT* numOfProperty)
UINT Image::GetPropertyCount() Gets the pixel format of this Image object.
GpStatus WINGDIPAPI GdipGetPropertyIdList(GpImage *image, UINT numOfProperty, PROPID* list)
Status Image::GetPropertyIdList( IN UINT numOfProperty, OUT PROPID* list ) Gets a list of the property identifiers used in the metadata of this Image object.
GpStatus WINGDIPAPI GdipGetPropertyItemSize(GpImage *image, PROPID propId, UINT* size)
UINT Image::GetPropertyItemSize( IN PROPID propId ) Gets the size, in bytes, of a specified property item of this Image object.
GpStatus WINGDIPAPI GdipGetPropertyItem(GpImage *image, PROPID propId,UINT propSize, PropertyItem* buffer)
Status Image::GetPropertyItem( IN PROPID propId, IN UINT propSize, OUT PropertyItem* buffer ) Gets a specified property item (piece of metadata) from this Image object.
GpStatus WINGDIPAPI GdipGetPropertySize(GpImage *image, UINT* totalBufferSize, UINT* numProperties)
Status Image::GetPropertySize( OUT UINT* totalBufferSize, OUT UINT* numProperties ) Gets the total size, in bytes, of all the property items stored in this Image object. This method also gets the number of property items stored in this Image object.
GpStatus WINGDIPAPI GdipGetAllPropertyItems(GpImage *image, UINT totalBufferSize, UINT numProperties, PropertyItem* allItems)
Status Image::GetAllPropertyItems( IN UINT totalBufferSize, IN UINT numProperties, OUT PropertyItem* allItems ) Gets all the property items (metadata) stored in this Image object.
GpStatus WINGDIPAPI GdipRemovePropertyItem(GpImage *image, PROPID propId)
Status Image::RemovePropertyItem( IN PROPID propId ) Removes a property item (piece of metadata) from this Image object.
GpStatus WINGDIPAPI GdipSetPropertyItem(GpImage *image, GDIPCONST PropertyItem* item)
Status Image::SetPropertyItem Sets a property item (piece of metadata) for this Image object. If the item already exists, then its contents are updated; otherwise, a new item is added.
GpStatus WINGDIPAPI GdipFindFirstImageItem(GpImage *image, ImageItemData* item)
Status Image::FindFirstItem( IN ImageItemData* item ) Retrieves the description and the data size of the first metadata item in this Image object.
GpStatus WINGDIPAPI GdipFindNextImageItem(GpImage *image, ImageItemData* item)
Status Image::FindNextItem( IN ImageItemData* item ) Retrieves the description and the data size of the next metadata item in this Image object. This method is used along with the Image::FindFirstItem method to enumerate the metadata items stored in this ImImageage object.
GpStatus WINGDIPAPI GdipGetImageItemData(GpImage *image, ImageItemData* item)
Status Image::GetItemData( IN ImageItemData* item ) Gets one piece of metadata from this Image object.
GpStatus WINGDIPAPI GdipImageSetAbort(GpImage *pImage, GdiplusAbort *pIAbort)
Status Image::SetAbort( GdiplusAbort *pIAbort ) Sets the object whose Abort method is called periodically during time-consuming rendering operation.
GpStatus WINGDIPAPI GdipConvertToEmfPlus(const GpGraphics* refGraphics, GpMetafile* metafile, BOOL* conversionSuccess, EmfType emfType, const WCHAR* description, GpMetafile** out_metafile)
Status Metafile::ConvertToEmfPlus( const Graphics* refGraphics, BOOL* conversionSuccess, EmfType emfType, const WCHAR* description ) Converts this Metafile object to the EMF+ format.
GpStatus WINGDIPAPI GdipConvertToEmfPlusToFile(const GpGraphics* refGraphics, GpMetafile* metafile, BOOL* conversionSuccess, const WCHAR* filename, EmfType emfType, const WCHAR* description, GpMetafile** out_metafile)
Status Metafile::ConvertToEmfPlus( const Graphics* refGraphics, const WCHAR* filename, BOOL* conversionSuccess, EmfType emfType, const WCHAR* description ) Converts this Metafile object to the EMF+ format.
GpStatus WINGDIPAPI GdipConvertToEmfPlusToStream(const GpGraphics* refGraphics, GpMetafile* metafile, BOOL* conversionSuccess, IStream* stream, EmfType emfType, const WCHAR* description, GpMetafile** out_metafile)
Status Metafile::ConvertToEmfPlus( const Graphics* refGraphics, IStream* stream, BOOL* conversionSuccess, EmfType emfType, const WCHAR* description ) Converts this Metafile object to the EMF+ format.
GpStatus WINGDIPAPI GdipImageForceValidation(GpImage *image)
Not called by wrapper methods.
This function forces validation of the image.