BitmapMetadata.GetQuery(String) 메서드

정의

비트맵 이미지 파일에서 메타데이터를 추출할 수 있는 메타데이터 쿼리 판독기에 대한 액세스를 제공합니다.

public:
 System::Object ^ GetQuery(System::String ^ query);
[System.Security.SecurityCritical]
public object GetQuery (string query);
public object GetQuery (string query);
[<System.Security.SecurityCritical>]
member this.GetQuery : string -> obj
member this.GetQuery : string -> obj
Public Function GetQuery (query As String) As Object

매개 변수

query
String

현재 BitmapMetadata 개체에서 쿼리되는 문자열을 식별합니다.

반환

Object

지정된 쿼리 위치에 있는 메타데이터입니다.

특성

예외

query이(가) null인 경우

예제

다음 코드 예제에서는 PNG(이식 가능한 네트워크 그래픽) 파일에 메타데이터를 쓰는 방법을 SetQuery 보여 줍니다.

Stream^ pngStream = gcnew FileStream("smiley.png", FileMode::Open, FileAccess::ReadWrite, FileShare::ReadWrite);
PngBitmapDecoder^ pngDecoder = gcnew PngBitmapDecoder(pngStream, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default);
BitmapFrame^ pngFrame = pngDecoder->Frames[0];
InPlaceBitmapMetadataWriter^ pngInplace = pngFrame->CreateInPlaceBitmapMetadataWriter();
if (pngInplace->TrySave() == true)
{
   pngInplace->SetQuery("/Text/Description", "Have a nice day.");
}
pngStream->Close();
Stream pngStream = new System.IO.FileStream("smiley.png", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
PngBitmapDecoder pngDecoder = new PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapFrame pngFrame = pngDecoder.Frames[0];
InPlaceBitmapMetadataWriter pngInplace = pngFrame.CreateInPlaceBitmapMetadataWriter();
if (pngInplace.TrySave() == true)
{ pngInplace.SetQuery("/Text/Description", "Have a nice day."); }
pngStream.Close();
Dim pngStream As New System.IO.FileStream("smiley.png", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)
Dim pngDecoder As New PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default)
Dim pngFrame As BitmapFrame = pngDecoder.Frames(0)
Dim pngInplace As InPlaceBitmapMetadataWriter = pngFrame.CreateInPlaceBitmapMetadataWriter()
If pngInplace.TrySave() = True Then
    pngInplace.SetQuery("/Text/Description", "Have a nice day.")
End If
pngStream.Close()

메타데이터를 작성한 GetQuery 후 메서드는 해당 데이터를 읽고 텍스트 문자열로 내보내는 데 사용됩니다.


// Add the metadata of the bitmap image to the text block.
TextBlock^ myTextBlock = gcnew TextBlock();
myTextBlock->Text = "The Description metadata of this image is: " + pngInplace->GetQuery("/Text/Description")->ToString();

// Add the metadata of the bitmap image to the text block.
TextBlock myTextBlock = new TextBlock();
myTextBlock.Text = "The Description metadata of this image is: " + pngInplace.GetQuery("/Text/Description").ToString();
' Add the metadata of the bitmap image to the text block.
Dim myTextBlock As New TextBlock()
myTextBlock.Text = "The Description metadata of this image is: " + pngInplace.GetQuery("/Text/Description").ToString()

설명

이미지와 연결된 메타데이터는 이미지를 설명하는 데이터이지만 이미지 표시에는 필요하지 않습니다. 지원되는 각 비트맵 이미지 형식은 메타데이터를 다르게 처리하지만 메타데이터를 읽고 쓰는 기능은 동일합니다.

WPF(Windows Presentation Foundation)는 Exchangeable 이미지 파일(Exif), tEXt(PNG 텍스트 데이터), IFD(이미지 파일 디렉터리), IPTC(International Press Telecommunications Council) 및 XMP(Extensible Metadata Platform)와 같은 이미지 메타데이터 스키마를 지원합니다.

적용 대상

추가 정보