Skip to content

Latest commit

 

History

History
171 lines (116 loc) · 6.21 KB

nf-gdiplusheaders-image-getframedimensionscount.md

File metadata and controls

171 lines (116 loc) · 6.21 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist req.product ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:gdiplusheaders.Image.GetFrameDimensionsCount
Image::GetFrameDimensionsCount (gdiplusheaders.h)
The Image::GetFrameDimensionsCount method gets the number of frame dimensions in this Image object.
GetFrameDimensionsCount
GetFrameDimensionsCount method [GDI+]
GetFrameDimensionsCount method [GDI+]
Image class
Image class [GDI+]
GetFrameDimensionsCount method
Image.GetFrameDimensionsCount
Image::GetFrameDimensionsCount
_gdiplus_CLASS_Image_GetFrameDimensionsCount_
gdiplus._gdiplus_CLASS_Image_GetFrameDimensionsCount_
gdiplus\_gdiplus_CLASS_Image_GetFrameDimensionsCount_.htm
gdiplus
VS|gdicpp|~\gdiplus\gdiplusreference\classes\imageclass\imagemethods\getframedimensionscount.htm
12/05/2018
GetFrameDimensionsCount, GetFrameDimensionsCount method [GDI+], GetFrameDimensionsCount method [GDI+],Image class, Image class [GDI+],GetFrameDimensionsCount method, Image.GetFrameDimensionsCount, Image::GetFrameDimensionsCount, _gdiplus_CLASS_Image_GetFrameDimensionsCount_, gdiplus._gdiplus_CLASS_Image_GetFrameDimensionsCount_
gdiplusheaders.h
Gdiplus.h
Windows
Windows XP, Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Gdiplus.lib
Gdiplus.dll
Windows
GDI+ 1.0
19H1
Image::GetFrameDimensionsCount
gdiplusheaders/Image::GetFrameDimensionsCount
c++
APIRef
kbSyntax
COM
Gdiplus.dll
Image.GetFrameDimensionsCount

Image::GetFrameDimensionsCount

-description

The Image::GetFrameDimensionsCount method gets the number of frame dimensions in this Image object.

-returns

Type: UINT

This method returns the number of frame dimensions in this Image object.

-remarks

This method returns information about multiple-frame images, which come in two styles: multiple page and multiple resolution.

A multiple-page image is an image that contains more than one image. Each page contains a single image (or frame). These pages (or images, or frames) are typically displayed in succession to produce an animated sequence, such as in an animated GIF file.

A multiple-resolution image is an image that contains more than one copy of an image at different resolutions.

Windows GDI+ can support an arbitrary number of pages (or images, or frames), as well as an arbitrary number of resolutions.

Examples

The following console application creates an Image object based on a TIFF file. The code calls the Image::GetFrameDimensionsCount method to find out how many frame dimensions the Image object has. Each of those frame dimensions is identified by a GUID, and the call to Image::GetFrameDimensionsList retrieves those GUIDs. The first GUID is at index 0 in the pDimensionIDs array. The call to the Image::GetFrameCount method determines the number of frames in the dimension identified by the first GUID.

#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;

INT main()
{
   GdiplusStartupInput gdiplusStartupInput;
   ULONG_PTR gdiplusToken;
   GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

   Image* image = new Image(L"Multiframe.tif");

   // How many frame dimensions does the Image object have?
   UINT count = 0;
   count = image->GetFrameDimensionsCount();
   printf("The number of dimensions is %d.\n", count);
   GUID* pDimensionIDs = (GUID*)malloc(sizeof(GUID)*count);

   // Get the list of frame dimensions from the Image object.
   image->GetFrameDimensionsList(pDimensionIDs, count);

   // Display the GUID of the first (and only) frame dimension.
   WCHAR strGuid[39];
   StringFromGUID2(pDimensionIDs[0], strGuid, 39);
   wprintf(L"The first (and only) dimension ID is %s.\n", strGuid);

   // Get the number of frames in the first dimension.
   UINT frameCount = image->GetFrameCount(&pDimensionIDs[0]);
   printf("The number of frames in that dimension is %d.\n", frameCount);
    
   free(pDimensionIDs);
   delete(image);
   GdiplusShutdown(gdiplusToken);
   return 0;
}

The preceding code, along with a particular file, Multiframe.tif, produced the following output:

The number of dimensions is 1.
The first (and only) dimension ID is {7462DC86-6180-4C7E-8E3F-EE7333A7A483}.
The number of frames in that dimension is 4.

You can look up the displayed GUID in Gdiplusimaging.h and see that it is the identifier for the page dimension. So the program output tells us that the file Multiframe.tif has four pages; that is, four frames in the page dimension.

-see-also

Copying Individual Frames from a Multiple-Frame Image

Creating and Saving a Multiple-Frame Image

EncoderParameter

Image

Image::GetFrameCount

Image::GetFrameDimensionsList

Image::SaveAdd Methods