Read Keywords from JPG
Read Keywords from JPG
I'm using the ImageMagickObject in a classic ASP environment. What I would like to do is read the keywords that other programs have put in there (like Adobe Bridge and Picasa) out of JPG files . With TIF files I have it working, using "identify" and "%[IPTC:2:25]", but with JPG files this field seems to be blank, unless the JPG originated from a TIF that had keywords in it. Where can I find the keywords in JPG files?
ImageMagick-6.6.2-3-Q16
ImageMagick-6.6.2-3-Q16
Re: Read Keywords from JPG
The metadata in JPEG image files are typically encoded in the EXIF profile rather than IPTC.
Re: Read Keywords from JPG
Thanks for the reply. I couldn't find any keywords in the EXIF data. I built a loop to go through all of the EXIF "tags" that are listed on this site http://www.imagemagick.org/script/escape.php. Are there other EXIF "tags" that the keywords could be under? I did also try %[EXIF:*], and didn't see any keywords there either.
Re: Read Keywords from JPG
Are you sure that your JPG file contains the keywords?
You can use "identify -verbose file.jpg" to display most of the metadata.
You can use "identify -verbose file.jpg" to display most of the metadata.
Re: Read Keywords from JPG
Yep, there are definitely keywords in the files, since Adobe Bridge can see them. Further research is leading me to believe that the keywords I am looking for are not stored in EXIF or IPTC. It appears that Adobe and Microsoft have a different place to store them called XMP. Can ImageMagick read XMP?
Re: Read Keywords from JPG
We might be looking at the same brethomp thing see viewtopic.php?f=1&t=16454
How did you input your keywords ?
If you open the image in a program like Notepad++ or a hex editor are they in an XML portion at the end of the file ?
How did you input your keywords ?
If you open the image in a program like Notepad++ or a hex editor are they in an XML portion at the end of the file ?
Re: Read Keywords from JPG
Bonzo,
Yes, if I open the JPG images in Notepad, I can find my keywords in the file. They are in a XML looking portion of the file, but in my case near the beginning of the file. In this format:
Edit: I missed one of your questions. The keywords were entered using Adobe Bridge.
Yes, if I open the JPG images in Notepad, I can find my keywords in the file. They are in a XML looking portion of the file, but in my case near the beginning of the file. In this format:
Code: Select all
<dc:subject>
<rdf:Bag>
<rdf:li>Keyword 1</rdf:li>
<rdf:li>Keyword 2</rdf:li>
<rdf:li>Keyword 3</rdf:li>
<rdf:Bag>
</dc:Subject>
Last edited by brethomp on 2010-06-18T05:49:32-07:00, edited 3 times in total.
Re: Read Keywords from JPG
Is it possible to post files on this forum?snibgo wrote:Post a sample.
Re: Read Keywords from JPG
Thanks snibgo, this works, but not optimal. The resulting "out.xmp" file is a text file containing only the XMP metadata. Now I just have to parse the XMP file to get the keywords...snibgo wrote:convert in.jpg out.xmp
Re: Read Keywords from JPG
Don't think so - at least not as fresh user.(?)brethomp wrote:Is it possible to post files on this forum?
FAQ
But you could use one of the various file hosting sites.
Re: Read Keywords from JPG
This method only seems to work with JPG files.snibgo wrote:convert in.jpg out.xmp
Re: Read Keywords from JPG
No, it works with other formats, too - TIF/PNG/etc. But it's possible for some special files that a certain profile isn't recognized.
Re: Read Keywords from JPG
It worked with a jpg file where the data was around line 54 but not on a CR2 file where the data was at the end on line 186187. Both lots of data were added to the image using Microsoft pro photo tools. No idea why my data was in the image or at the end and and brethomp had his at the start.
I have not had any experiance of this but thought an xmp file was a file linked to and image not part of the image file. Will need some more investigation.
I have not had any experiance of this but thought an xmp file was a file linked to and image not part of the image file. Will need some more investigation.