Image.PropertyItems プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Image.PropertyItems プロパティの意味・解説 

Image.PropertyItems プロパティ

この Image格納されすべてのプロパティ項目 (メタデータ一部) を取得します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public ReadOnly Property
 PropertyItems As PropertyItem()
Dim instance As Image
Dim value As PropertyItem()

value = instance.PropertyItems
public PropertyItem[] PropertyItems { get;
 }
public:
property array<PropertyItem^>^ PropertyItems {
    array<PropertyItem^>^ get ();
}
/** @property */
public PropertyItem[] get_PropertyItems ()
public function get PropertyItems
 () : PropertyItem[]

プロパティ
このイメージ格納された各プロパティ項目に対して 1 つずつ存在する PropertyItem の配列

解説解説

イメージプロパティ項目がないか、イメージ形式プロパティ項目がサポートされていない場合PropertyItems は、空の配列 (長さが 0 の配列) を返します

使用例使用例

System.Drawing.Imaging.PropertyItem クラスPropertyItems プロパティ使用してイメージ ファイル内のメタデータ読み取り表示を行う方法次のコード例示します

この例は、System.Drawing.Imaging 名前空間インポートする Windows フォームでの使用意図してデザインされています。コードフォーム貼り付けシステムイメージ ファイルを指すように fakePhoto.jpg へのパス変更しますフォームPaint イベント処理する際に ExtractMetaData メソッド呼び出しe を PaintEventArgs として渡します

Private Sub ExtractMetaData(ByVal
 e As PaintEventArgs)

    Try
        'Create an Image object. 
        Dim theImage As Image = New
 Bitmap("c:\fakePhoto.jpg")

        'Get the PropertyItems property from image.
        Dim propItems As PropertyItem() = theImage.PropertyItems

        'Set up the display.
        Dim font As New
 font("Arial", 10)
        Dim blackBrush As New
 SolidBrush(Color.Black)
        Dim X As Integer
 = 0
        Dim Y As Integer
 = 0

        'For each PropertyItem in the array, display the id, type, and
 length.
        Dim count As Integer
 = 0
        Dim propItem As PropertyItem
        For Each propItem In
 propItems

            e.Graphics.DrawString("Property Item "
 + count.ToString(), _
               font, blackBrush, X, Y)
            Y += font.Height

            e.Graphics.DrawString("   iD: 0x" &
 propItem.Id.ToString("x"), _
               font, blackBrush, X, Y)
            Y += font.Height

            e.Graphics.DrawString("   type: " &
 propItem.Type.ToString(), _
               font, blackBrush, X, Y)
            Y += font.Height

            e.Graphics.DrawString("   length: " &
 propItem.Len.ToString() & _
                " bytes", font, blackBrush, X, Y)
            Y += font.Height

            count += 1
        Next propItem

        font.Dispose()
    Catch ex As ArgumentException
        MessageBox.Show("There was an error. Make sure the path
 to the image file is valid.")
    End Try

End Sub
private void ExtractMetaData(PaintEventArgs
 e)
{
    try
    {
        // Create an Image object. 
        Image theImage = new Bitmap("c:\\fakePhoto.jpg");

        // Get the PropertyItems property from image.
        PropertyItem[] propItems = theImage.PropertyItems;

        // Set up the display.
        Font font1 = new Font("Arial", 10);
        SolidBrush blackBrush = new SolidBrush(Color.Black);
        int X = 0;
        int Y = 0;

        // For each PropertyItem in the array, display the id, 
        // type, and length.
        int count = 0;
        foreach ( PropertyItem propItem in
 propItems )
        {
            e.Graphics.DrawString("Property Item " + 
                count.ToString(), font1, blackBrush, X, Y);
            Y += font1.Height;

            e.Graphics.DrawString("   ID: 0x" + 
                propItem.Id.ToString("x"), font1, blackBrush, X, Y);
            Y += font1.Height;

            e.Graphics.DrawString("   type: " +
                propItem.Type.ToString(), font1, blackBrush, X, Y);
            Y += font1.Height;

            e.Graphics.DrawString("   length: " + 
                propItem.Len.ToString() + 
                " bytes", font1, blackBrush, X, Y);
            Y += font1.Height;
            count += 1;
        }
        font1.Dispose();
    }
    catch(Exception)
    {
        MessageBox.Show("There was an error." + 
            "Make sure the path to the image file is valid.");
    }

}
private:
   void ExtractMetaData( PaintEventArgs^ e )
   {
      try
      {
         
         // Create an Image object. 
         Image^ theImage = gcnew Bitmap( "c:\\fakePhoto.jpg" );
         
         // Get the PropertyItems property from image.
         array<PropertyItem^>^propItems = theImage->PropertyItems;
         
         // Set up the display.
         System::Drawing::Font^ font1 = gcnew System::Drawing::Font( "Arial",10
 );
         SolidBrush^ blackBrush = gcnew SolidBrush( Color::Black );
         int X = 0;
         int Y = 0;
         
         // For each PropertyItem in the array, display the id, 
         // type, and length.
         int count = 0;
         System::Collections::IEnumerator^ myEnum = propItems->GetEnumerator();
         while ( myEnum->MoveNext() )
         {
            PropertyItem^ propItem = safe_cast<PropertyItem^>(myEnum->Current);
            e->Graphics->DrawString( String::Format( "Property Item {0}",
 count ), font1, blackBrush, (float)X, (float)Y
 );
            Y += font1->Height;
            e->Graphics->DrawString( String::Format( "   ID: 0x{0}",
 propItem->Id.ToString( "x" ) ), font1, blackBrush, (float)X,
 (float)Y );
            Y += font1->Height;
            e->Graphics->DrawString( String::Format( "   type: {0}",
 propItem->Type ), font1, blackBrush, (float)X, (float)Y
 );
            Y += font1->Height;
            e->Graphics->DrawString( String::Format( "   length: {0} bytes",
 propItem->Len ), font1, blackBrush, (float)X, (float)Y
 );
            Y += font1->Height;
            count += 1;
         }
         delete font1;
      }
      catch ( Exception^ ) 
      {
         MessageBox::Show( "There was an error."
         "Make sure the path to the image file is valid." );
      }

   }
private void ExtractMetaData(PaintEventArgs
 e)
{
    try {
        // Create an Image object. 
        Image theImage = new Bitmap("c:\\fakePhoto.jpg");

        // Get the PropertyItems property from image.
        PropertyItem propItems[] = theImage.get_PropertyItems();

        // Set up the display.
        Font font1 = new Font("Arial", 10);
        SolidBrush blackBrush = new SolidBrush(Color.get_Black());
        int X = 0;
        int Y = 0;

        // For each PropertyItem in the array, display the id, 
        // type, and length.
        int count = 0;

        //foreach (PropertyItem propItem in propItems)
        for (int iCtr = 0; iCtr < propItems.length;
 iCtr++) {
            PropertyItem propItem = propItems[iCtr];
            e.get_Graphics().DrawString("Property Item "  
                + System.Convert.ToString(count), font1, blackBrush, X, Y);
            Y += font1.get_Height();
            e.get_Graphics().DrawString("   ID: 0x" 
                + ((System.Int32)propItem.get_Id()).ToString("x"), font1,
 
                blackBrush, X, Y);
            Y += font1.get_Height();
            e.get_Graphics().DrawString("   type: "  
                + System.Convert.ToString(propItem.get_Type()), font1, 
                blackBrush, X, Y);
            Y += font1.get_Height();
            e.get_Graphics().DrawString("   length: "  
                + System.Convert.ToString(propItem.get_Len()) + " bytes",
 
                font1, blackBrush, X, Y);
            Y += font1.get_Height();
            count += 1;
        }
        font1.Dispose();
    }
    catch (System.Exception exp) {
        MessageBox.Show(("There was an error."  
            + "Make sure the path to the image file is valid."));
    }
} //ExtractMetaData
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からImage.PropertyItems プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からImage.PropertyItems プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からImage.PropertyItems プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Image.PropertyItems プロパティ」の関連用語

Image.PropertyItems プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Image.PropertyItems プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS