Introduction In this post, I will demonstrate how to read image metadata using BitmapMetadata class in C#. Before staring explanation, we should notice there are two namespaces that can handle image in C#. System.Drawing namespace: I tested in this post System.Windows.Media.Imaging In this post, we will use classes under System.Windows.Media.Imaging. Code for Reading Image Metadata Actually code itself is quite simple :) Please see code below. using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows.Media.Imaging; using System.Diagnostics; namespace MetadataExample { public static class ReadImageMetadataExample { public static void a(string fileName) { var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); var img = BitmapFrame.Create(fs); var metadata = img.Metadata as BitmapMetadata; Debug.WriteLine("=== metadata ===...
IT関連の技術やプログラミングを中心に記事を書いています。ハードウェアも好きなので、日々のちょっとしたお役立ち情報も投稿しています。