Click here to Skip to main content
Click here to Skip to main content
Go to top

EXIF tag Editor for JPG images

, 18 Sep 2006
Rate this:
Please Sign up or sign in to vote.
JPG images EXIF tag Editor

Click to enlarge ...

Introduction

First of all, I must say that there are very good articles (here on codeProject) dealing with EXIF tag reading:

and some others explaining EXIF tag writing:

But as it happens most of the time, I needed a small app that would allow me to update a specific EXIF tag, and I wanted it done in C# (for learning purposes). After reading the previous articles and some other references carefully, I decided to go ahead and write a binary to solve my problems.

So, what we have here is a utility that updates EXIF tag '0x9003' (Tag DateTimeOriginal) and EXIF tag '0x9004' (Tag DateTimeDigitized). Other EXIF tags could be updated using the same technique:

.
.
.
Encoding _Encoding = Encoding.UTF8;
Image theImage = new Bitmap(m_currImageFileTemp);
PropertyItem propItem36867 = theImage.GetPropertyItem(36867);

propItem36867.Value = _Encoding.GetBytes(m_textPropertyValue.Text + '\0');
theImage.SetPropertyItem(propItem36867);
theImage.Save(m_currImageFile);
.
.
.

Where Encoding, Image, Bitmap and PropertyItem are .NET 2.0 classes.

You can find information about EXIF standard here.

I hope you find the code useful.

Using the utility

As you can see in the image enclosed, the utility reads the date to update from a free input. The format for that string MUST be 'YYYY:MM:DD hh:mm:ss', in any other case the program won't be able to update the EXIF tags safely.

I am enclosing a picture with EXIF tags for testing purposes: you will find it in the root folder of the zip file.

The code was compiled using Microsoft Visual Studio 2005, I can't tell if it will compile with previous versions. To execute it you will need the .NET framework 2.0.

About Jose Javier Sanjosé

Software architect, system administrator, web designer. I have been using C++ for the last 16 years, mainly until .NET come around (even though I try not to follow Microsoft's trends too close anymore).

Nowadays I am very focused in XML, XSLT, JavaScript, Java, ASP.NET, PHP, and well, yes, C#.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

jsanjosem
Web Developer
Spain Spain
No Biography provided

Comments and Discussions

 
QuestionAwesome! Pinmembertoxicious16-Mar-12 13:20 
BugIf EXIF tag does noe exist, there is an error, could you help with this Pinmemberper7811-Dec-11 4:56 
GeneralRe: If EXIF tag does noe exist, there is an error, could you help with this Pinmemberjsanjosem12-Dec-11 0:34 
GeneralRe: If EXIF tag does noe exist, there is an error, could you help with this PinmemberAlterDiaz23-Sep-12 20:06 
GeneralThanks! You saved my Day! Pinmemberh3214-Sep-09 6:50 
GeneralLatin Character not work Pinmemberwaimoehtun25-Jan-07 2:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140921.1 | Last Updated 18 Sep 2006
Article Copyright 2006 by jsanjosem
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid