다음을 통해 공유


Image::GetPropertyItem 메서드(gdiplusheaders.h)

Image::GetPropertyItem 메서드는 이 Image 개체에서 지정된 속성 항목(메타데이터 조각)을 가져옵니다.

구문

Status GetPropertyItem(
  [in]  PROPID       propId,
  [in]  UINT         propSize,
  [out] PropertyItem *buffer
);

매개 변수

[in] propId

형식: PROPID

검색할 속성 항목을 식별하는 정수입니다.

[in] propSize

형식: UINT

검색할 속성 항목의 크기(바이트)를 지정하는 정수입니다. Image::GetPropertyItemSize 메서드를 호출하여 크기를 결정합니다.

[out] buffer

형식: PropertyItem*

속성 항목을 수신하는 PropertyItem 개체에 대한 포인터입니다.

반환 값

형식: 상태

메서드가 성공하면 Status 열거형의 요소인 확인을 반환합니다.

메서드가 실패하면 Status 열거형의 다른 요소 중 하나를 반환합니다.

설명

Image::GetPropertyItem 메서드는 PropertyItem 개체를 반환합니다. Image::GetPropertyItem을 호출하기 전에 해당 개체를 받을 수 있을 만큼 큰 버퍼를 할당해야 합니다. 크기는 속성 항목의 데이터 형식 및 값에 따라 달라집니다. Image 개체의 Image::GetPropertyItemSize 메서드를 호출하여 필요한 버퍼의 크기를 바이트 단위로 가져올 수 있습니다.

예제

다음 예제에서는 JPEG 파일을 기반으로 Image 개체를 만듭니다. 이 코드는 PropertyTagEquipMake 상수를 Image 개체의 Image::GetPropertyItem 메서드에 전달하여 이미지를 캡처한 카메라의 메이크를 가져옵니다.

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

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

   UINT size = 0;
   PropertyItem* propertyItem = NULL;
   Image* image = new Image(L"FakePhoto.jpg");

   // Assume that the image has a property item of type PropertyItemEquipMake.
   // Get the size of that property item.
   size = image->GetPropertyItemSize(PropertyTagEquipMake);

   // Allocate a buffer to receive the property item.
   propertyItem = (PropertyItem*)malloc(size);

   // Get the property item.
   image->GetPropertyItem(PropertyTagEquipMake, size, propertyItem);

   // Display the members of the retrieved PropertyItem object.
   printf("The length of the property item is %u.\n", propertyItem->length);
   printf("The data type of the property item is %u.\n", propertyItem->type);

   if(propertyItem->type == PropertyTagTypeASCII)
      printf("The value of the property item is %s.\n", propertyItem->value);

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

이전 코드는 특정 파일과 함께 FakePhoto.jpg 다음 출력을 생성했습니다. 데이터 형식은 Gdiplusimaging.h에 정의된 PropertyTagTypeASCII 상수 값인 2입니다.

The length of the property item is 17.
The data type of the property item is 2.
The value of the property item is Northwind Traders.

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows XP, Windows 2000 Professional [데스크톱 앱만 해당]
지원되는 최소 서버 Windows 2000 Server[데스크톱 앱만]
대상 플랫폼 Windows
헤더 gdiplusheaders.h(Gdiplus.h 포함)
라이브러리 Gdiplus.lib
DLL Gdiplus.dll

추가 정보

이미지

이미지::GetAllPropertyItems

이미지::GetPropertyCount

이미지::GetPropertyIdList

이미지::GetPropertyItemSize

이미지::GetPropertySize

이미지::RemovePropertyItem

이미지::SetPropertyItem

PropertyItem

메타데이터 읽기 및 쓰기