Click here to Skip to main content
11,433,997 members (58,605 online)
Click here to Skip to main content
Add your own
alternative version

EXIF Compare Utility using WPF

, 12 Apr 2010 CPOL
The Exif Compare Utility is a WinDiff equivalent for image files that compares the Exif meta-data and displays the differences and similarities. The application is written using WPF and MVVM.
ExifCompareSource.zip
ExifReader
Properties
PropertyFormatters
UndefinedExtractor
ExifCompare
Images
Clear.png
CompareFiles.png
HelpAbout.png
Model
NS.MVVM
Properties
Settings.settings
ViewModel
// <copyright file="ExifExposureTimePropertyFormatter.cs" company="Nish Sivakumar">
// Copyright (c) Nish Sivakumar. All rights reserved.
// </copyright>

namespace ExifReader.PropertyFormatters
{
    using System;
    using System.ComponentModel;
    using System.Linq;

    /// <summary>
    /// An IExifPropertyFormatter specific to the Exposure Time property
    /// </summary>
    internal class ExifExposureTimePropertyFormatter : IExifPropertyFormatter
    {
        /// <summary>
        /// Gets a display name for this property
        /// </summary>
        public string DisplayName
        {
            get
            {
                return "Exposure time";
            }
        }

        /// <summary>
        /// Gets a formatted string for a given Exif value
        /// </summary>
        /// <param name="exifValue">The source Exif value</param>
        /// <returns>The formatted string</returns>
        public string GetFormattedString(IExifValue exifValue)
        {
            var values = exifValue.Values.Cast<Rational32>();

            if (values.Count() == 0)
            {
                return String.Empty;
            }

            Rational32 exposure = values.First();
            uint numerator = (uint)exposure.Numerator;
            uint denominator = (uint)exposure.Denominator;

            return denominator == 1 ? String.Format("{0} sec.", numerator) : String.Format("{0}/{1} sec.", numerator, denominator);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Nish Nishant

United States United States
Nish Nishant is a Software Architect/Consultant based out of Columbus, Ohio. He has over 15 years of software industry experience in various roles including Lead Software Architect, Principal Software Engineer, and Product Manager. Nish is a recipient of the annual Microsoft Visual C++ MVP Award since 2002 (13 consecutive awards as of 2014).

Nish is an industry acknowledged expert in the Microsoft technology stack. He authored
C++/CLI in Action for Manning Publications in 2005, and had previously co-authored
Extending MFC Applications with the .NET Framework for Addison Wesley in 2003. In addition, he has over 140 published technology articles on CodeProject.com and another 250+ blog articles on his
WordPress blog. Nish is vastly experienced in team management, mentoring teams, and directing all stages of software development.

Contact Nish : You can reach Nish on his google email id voidnish.

Website and Blog

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150428.2 | Last Updated 12 Apr 2010
Article Copyright 2010 by Nish Nishant
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid