Método Image::GetAllPropertyItems (gdiplusheaders.h)

El método Image::GetAllPropertyItems obtiene todos los elementos de propiedad (metadatos) almacenados en este objeto Image .

Sintaxis

Status GetAllPropertyItems(
  [in]  UINT         totalBufferSize,
  [in]  UINT         numProperties,
  [out] PropertyItem *allItems
);

Parámetros

[in] totalBufferSize

Tipo: UINT

Entero que especifica el tamaño, en bytes, del búfer allItems . Llame al método Image::GetPropertySize para obtener el tamaño necesario.

[in] numProperties

Tipo: UINT

Entero que especifica el número de propiedades de la imagen. Llame al método Image::GetPropertySize para obtener este número.

[out] allItems

Tipo: PropertyItem*

Puntero a una matriz de objetos PropertyItem que recibe los elementos de propiedad.

Valor devuelto

Tipo: Estado

Si el método se ejecuta correctamente, devuelve Ok, que es un elemento de la enumeración Status .

Si se produce un error en el método, devuelve uno de los otros elementos de la enumeración Status .

Comentarios

Algunos archivos de imagen contienen metadatos que se pueden leer para determinar las características de la imagen. Por ejemplo, una fotografía digital podría contener metadatos que se pueden leer para determinar la marca y el modelo de la cámara empleada para capturar la imagen.

GDI+ almacena un fragmento individual de metadatos en un objeto PropertyItem . El método Image::GetAllPropertyItems devuelve una matriz de objetos PropertyItem . Antes de llamar a Image::GetAllPropertyItems, debe asignar un búfer lo suficientemente grande como para recibir esa matriz. Puede llamar al método Image::GetPropertySize de un objeto Image para obtener el tamaño, en bytes, del búfer necesario. El método Image::GetPropertySize también proporciona el número de propiedades (fragmentos de metadatos) de la imagen.

En Gdiplusimaging.h se definen varias enumeraciones y constantes relacionadas con los metadatos de imagen.

Ejemplos

En el ejemplo siguiente se crea un objeto Image basado en un archivo JPEG. El código llama al método GetAllPropertyItems de ese objeto Image para obtener sus elementos de propiedad (metadatos).

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

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

   // Create an Image object based on a JPEG file.
   Image* image = new Image(L"FakePhoto.jpg"); 

   // Find out how many property items are in the image, and find out the
   // required size of the buffer that will receive those property items.
   UINT totalBufferSize;
   UINT numProperties;
   image->GetPropertySize(&totalBufferSize, &numProperties);

   // Allocate the buffer that will receive the property items.
   PropertyItem* pAllItems = (PropertyItem*)malloc(totalBufferSize);

   // Fill the buffer.
   image->GetAllPropertyItems(totalBufferSize, numProperties, pAllItems);

// Print the id data member of each property item.
   for(UINT j = 0; j < numProperties; ++j)
   {
      printf("%x\n", pAllItems[j].id);
   }

   free(pAllItems);
   delete image;
   GdiplusShutdown(gdiplusToken);
   return 0;
}

El código anterior, junto con un archivo determinado, FakePhoto.jpg, generó la siguiente salida:

320
10f
110
9003
829a
5090
5091

La salida anterior muestra un número de identificador hexadecimal para cada elemento de propiedad. Puede buscar esos números de identificador en Gdiplusimaging.h y averiguar que representan las siguientes etiquetas de propiedad.

Valor hexadecimal Etiqueta de propiedad
0x0320 PropertyTagImageTitle
0x010f PropertyTagEquipMake
0x0110 PropertyTagEquipModel
0x9003 PropertyTagExifDTOriginal
0x829a PropertyTagExifExposureTime
0x5090 PropertyTagLuminanceTable
0x5091 PropertyTagChrominanceTable
 

Requisitos

   
Cliente mínimo compatible Windows XP, Windows 2000 Professional [solo aplicaciones de escritorio]
Servidor mínimo compatible Windows 2000 Server [solo aplicaciones de escritorio]
Plataforma de destino Windows
Encabezado gdiplusheaders.h (include Gdiplus.h)
Library Gdiplus.lib
Archivo DLL Gdiplus.dll

Consulte también

Imagen

Image::GetPropertyCount

Image::GetPropertyIdList

Image::GetPropertyItem

Image::GetPropertyItemSize

Image::GetPropertySize

Image::RemovePropertyItem

Image::SetPropertyItem

PropertyItem

Lectura y escritura de metadatos