Solved

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

Posted on 2006-06-16
2
618 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

912 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now