WikiCrawler/Utility/ImageUtility.cs
/// <summary>
/// Returns a dictionary of EXIF metadata from the specified file.
/// </summary>
Returns a dictionary of EXIF metadata from the specified file.
Returns a dictionary of EXIF metadata from the specified file .
public static Dictionary<string, FreeImageTag> GetExif(string sourceFile)
	{
		FIBITMAP raw = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, sourceFile, FREE_IMAGE_LOAD_FLAGS.DEFAULT);
		Dictionary<string, FreeImageTag> results = new Dictionary<string, FreeImageTag>();
		FITAG tag;
		FIMETADATA handle = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, raw, out tag);
		while (!tag.IsNull)
		{
			FreeImageTag nicetag = new FreeImageTag();
			nicetag.Key = FreeImage.GetTagKey(tag);
			nicetag.Description = FreeImage.GetTagDescription(tag);
			nicetag.Type = FreeImage.GetTagType(tag);
			nicetag.Length = FreeImage.GetTagLength(tag);
			nicetag.Value = FreeImage.GetTagValue(tag);
			nicetag.StringValue = nicetag.GetValue().ToString();
			results[nicetag.Key] = nicetag;
			if (!FreeImage.FindNextMetadata(handle, out tag))
			{
				break;
			}
		}
		FreeImage.Unload(raw);
		return results;
	}
public static Dictionary < string , FreeImageTag > GetExif ( string sourceFile ) { FIBITMAP raw = FreeImage . Load ( FREE_IMAGE_FORMAT . FIF_JPEG , sourceFile , FREE_IMAGE_LOAD_FLAGS . DEFAULT ) ; Dictionary < string , FreeImageTag > results = new Dictionary < string , FreeImageTag > ( ) ; FITAG tag ; FIMETADATA handle = FreeImage . FindFirstMetadata ( FREE_IMAGE_MDMODEL . FIMD_EXIF_EXIF , raw , out tag ) ; while ( ! tag . IsNull ) { FreeImageTag nicetag = new FreeImageTag ( ) ; nicetag . Key = FreeImage . GetTagKey ( tag ) ; nicetag . Description = FreeImage . GetTagDescription ( tag ) ; nicetag . Type = FreeImage . GetTagType ( tag ) ; nicetag . Length = FreeImage . GetTagLength ( tag ) ; nicetag . Value = FreeImage . GetTagValue ( tag ) ; nicetag . StringValue = nicetag . GetValue ( ) . ToString ( ) ; results [ nicetag . Key ] = nicetag ; if ( ! FreeImage . FindNextMetadata ( handle , out tag ) ) { break ; } } FreeImage . Unload ( raw ) ; return results ; }
Returns a dictionary of EXIF metadata from the specified file.
Returns a dictionary of EXIF metadata from the specified file .
sourceFile
string