A very quick hack to check if an image is a photo in C#, using image properties, is to see if there’s a “camera manufacturer” property set:
[csharp]
foreach (var img in Directory.GetFiles(imagedump))
{
using (var fs = new FileStream(img, FileMode.Open))
using (var i = Image.FromStream(fs))
{
foreach (var p in
from p in i.PropertyItems
where p.Id == 271 // manufacturer property
select p)
{
var encoding = new ASCIIEncoding();
var manufacturer = encoding.GetString(p.Value);
Console.WriteLine("Camera make:{0}", manufacturer);
}
}
}
[/csharp]
Learned from a little msdn article; the value 271 is the integer version of the hex “0x010F” in the table of common IDs.