Solved

How do I set/get the Keywords property of a JPG file in Windows XP SP2?

Posted on 2006-06-16
2
624 Views
Last Modified: 2008-03-04
Environment:
Windows XP SP2 (on NTFS)
JPG picture taken from any camera
Any Programming Language

Please verify your answer before submitting it, because JPG files do not behave the same as other file types in Windows XP.

How do I programmatically get and set the Keywords (located on the Summary Tab of the Properties of a JPG file) field on a JPG file?

1. Locate a JPG (example: C:\Pic.jpg)
2. In Windows Explorer, right-click on the file, choose Properties, click on the Summary Tab and examine the "Keywords" field.
3. Type "MyTestKeyword" into the Keywords field and click OK
4. Run your code sample which should read the Keywords property of the file
5. Programmitically change the keyword to "UpdatedKeyWord" and resave the file.
6. Back in Windows Explorer, right-click on the file, choose Properties, click on the Summary Tab and examine the "Keywords" field.  It should read:  "UpdatedKeyWord"


NOTE: DSOFile.DLL has already been tried, and does not work on JPG files, also DocumentSummaryInformation streams on NTFS do not work on JPG files, also EXIF and IPTC Properties do not work because they are not reflected in the Keywords property of the file (through Windows Explorer)
0
Comment
Question by:thebatdude
2 Comments
 
LVL 1

Accepted Solution

by:
spamsickle earned 500 total points
ID: 16928522
Actually, JPEG files behave like other files in XP too.  The problem is that there are keywords, and there are XP keyword.  The keywords you're trying to change are XP keywords.

You said the solution could be in any language, so I'm submitting one I tested that requires Perl.  Assuming you have the Activestate Perl environment installed on your computer, you would need to download and install Phil Harvey's excellent Exiftool from http://www.sno.phy.queensu.ca/~phil/exiftool/.  If you don't have Activestate Perl, you should install that first.

Exiftool has a command-line interface named Exiftool, which is in the root directory of the Exiftool installation.  To execute it under Windows XP to do what you want to do, you would (from the Exiftool directory) issue the command:

perl exiftool "-XPKeywords=MyKeyWord1 MyKeyWord2" "d:\imagefilepath\imagefile.jpg"

The Exiftool installation requires you to ungzip and untar, but there are utilities to do that on Windows too.  I used 7-zip from www.7-zip.org (run it twice, once to ungzip, and again to untar).

I've tested this solution, and it works.  You'll have to do a bit of legwork, but Activestate Perl is a pretty painless installation, and exiftool is worth the effort.
0
 
LVL 1

Author Comment

by:thebatdude
ID: 16935945
Awesome, that was just enough clues to get me to google on XPKeywords and I located the EXIF Tag ID (40095) for this EXIF property, then was able to write some .NET Code to read and set the property based on the EXIF Tag ID.

3 Weeks of my life gone forever on this one.

Thank you for the help!!

0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question