Click here to Skip to main content
14,301,827 members

EXIF tag Editor for JPG images

Rate this:
4.64 (16 votes)
Please Sign up or sign in to vote.
4.64 (16 votes)
18 Sep 2006
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

 
Questionimage.Save(String filename) makes PNG files. Pin
Nyerguds8-Feb-18 21:19
memberNyerguds8-Feb-18 21:19 
AnswerRe: image.Save(String filename) makes PNG files. Pin
Croow23-Apr-18 7:41
memberCroow23-Apr-18 7:41 
QuestionAwesome! Pin
toxicious16-Mar-12 13:20
membertoxicious16-Mar-12 13:20 
BugIf EXIF tag does noe exist, there is an error, could you help with this Pin
per7811-Dec-11 4:56
memberper7811-Dec-11 4:56 
GeneralRe: If EXIF tag does noe exist, there is an error, could you help with this Pin
jsanjosem12-Dec-11 0:34
memberjsanjosem12-Dec-11 0:34 
GeneralRe: If EXIF tag does noe exist, there is an error, could you help with this Pin
AlterDiaz23-Sep-12 20:06
memberAlterDiaz23-Sep-12 20:06 
GeneralThanks! You saved my Day! Pin
h3214-Sep-09 6:50
memberh3214-Sep-09 6:50 
GeneralLatin Character not work Pin
waimoehtun25-Jan-07 2:07
memberwaimoehtun25-Jan-07 2:07 

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

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

Article
Posted 18 Sep 2006

Stats

129.4K views
6.8K downloads
107 bookmarked