Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Image.GetRawFormat method

Applies to: desktop apps only

The Image::GetRawFormat method 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.

Syntax

Status GetRawFormat(
  [out]  GUID *format
);

Parameters

format [out]

Type: GUID*

Pointer to a GUID that receives the format identifier.

Return value

Type:

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Examples

The following example creates an Image object based on a JPEG file. The code obtains and displays the GUID that identifies the format of the image. Then the code verifies that the image format is JPEG.


#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"FakePhoto.jpg");
   GUID guid;
   WCHAR strGuid[39];

   // Get the GUID that identifies the image format.
   image->GetRawFormat(&guid);

   // Convert the GUID to a string and display it.
   StringFromGUID2(guid, strGuid, 39);
   wprintf(L"The GUID is %s.\n", strGuid);

   // Was the GUID that identifies the JPEG format retrieved?
   if(guid == ImageFormatJPEG)
      printf("The format is JPEG.\n");
  
   delete image;
   GdiplusShutdown(gdiplusToken);
   return 0;
}

The preceding code, along with a particular file, FakePhoto.jpg, produced the following output:


The GUID is {B96B3CAE-0728-11D3-9D7B-0000F81EF32E}.
The format is JPEG.

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusheaders.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Image
Bitmap
Image::GetType
ImageType
Using Images, Bitmaps, and Metafiles
Images, Bitmaps, and Metafiles

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Show: