The DAM Forum
Welcome, Guest. Please login or register.
April 23, 2014, 01:42:44 AM

Login with username, password and session length
Search:     Advanced search
28003 Posts in 5130 Topics by 2912 Members
Latest Member: kbroch
* Home Help Search Login Register
+  The DAM Forum
|-+  Software Discussions
| |-+  Scripting
| | |-+  Can I automate the writing of XMP metadata into JPEG and TIFF files?
« previous next »
Pages: [1] Print
Author Topic: Can I automate the writing of XMP metadata into JPEG and TIFF files?  (Read 7463 times)
David Anderson
Sr. Member
****
Posts: 287


View Profile
« on: October 31, 2008, 09:47:54 AM »

I have written an ASP.NET 3.5 website application on behalf of an annual international photographic competition. Entrants will be uploading digital photos in either JPEG or TIFF format. Ideally, I would write entrant identity and image title information into the XMP metadata for each image immediately after upload - but so far, I have failed to find any way to do this in ASP.NET.

Thousands of images are involved, so I need to find a way to automate the metadata insertion, perhaps with some sort of script that uses a text file (extracted from the SQL Server database on my website) as the source of the metadata for a batch of images. Can any of the scripting gurus on this forum advise on a good way to do this task?

I have the Adobe CS3 suite, Extensis Portfolio 8 and iView MediaPro 3 on my Win XP PC, in case any of these could be exploited for this purpose. I also have a colleague who has an Apple Mac (running under the Leopard OS), so we could use scripts for either platform.

David
Logged
rogerhoward
Full Member
***
Posts: 103


View Profile Email
« Reply #1 on: October 31, 2008, 02:58:08 PM »

Checkout exiftool: http://www.sno.phy.queensu.ca/~phil/exiftool/

This is a very robust component (both a perl library and a command line application) that has excellent support for both r/w of XMP (and a variety of other metadata formats). There's no need to export your database to text file first (though that's of course possible) - just build a process in your ASP.NET application to call exiftool directly, passing it the data you want to embed and the image file to embed into. You could either do this in a batch mode (say once a night) or, perhaps even better, do it at the point of upload - as you receive and process the uploaded file, inject the metadata then (if you have all the data you need at that point).

Without knowing more about your application that's about as close as I can get... in any case, exiftool is, bar none, my favorite tool for almost all metadata reading and writing. There's an official XMP SDK with example code from Adobe, but that's far more complicated and I'd only recommend that if you were building an off the shelf application for commercial distribution.
Logged

-----

Roger Howard
David Anderson
Sr. Member
****
Posts: 287


View Profile
« Reply #2 on: October 31, 2008, 03:04:57 PM »

Hi Roger,
Thanks for that suggestion. I'm still pretty new to ASP.NET so I don't yet know how I would "build a process in your ASP.NET application to call exiftool directly". However, I will start googling for guidance on how to do that and post my results back here in due course.

David
Logged
rogerhoward
Full Member
***
Posts: 103


View Profile Email
« Reply #3 on: October 31, 2008, 03:26:26 PM »

I'm not an ASP.NET programmer - I do my web applications in PHP - but there appear to be two ASP.NET methods to call external programs... System.Diagnostics.Process and Shell()

The basic idea is you have an external command line application - in this case exiftool - and you call (execute) it from your ASP.NET script, passing it whatever parameters you want. ASP.NET launches exiftool with those parameters, exiftool runs, and then returns the results back to ASP.NET when done.

Here's an article that appears to have relevant code examples:

http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.aspnet/2004-03/8427.html

I can definitely help on the specifics of how to use exiftool - that'll be half the battle. If you don't want to integrate it into your ASP.NET app, then you'll need a script to extract the data from your SQL database, and then call exiftool - basically, it'll take more or less the same knowledge as above.

Grab exiftool - there's a bunch of good examples of basic writing metadata on the site
Logged

-----

Roger Howard
David Anderson
Sr. Member
****
Posts: 287


View Profile
« Reply #4 on: October 31, 2008, 03:39:42 PM »

I also found similar guidance after some googling and am currently investigating System.Diagnostics.Process. I have also downloaded ExifTool. However, I might put off a serious effort on this until the weekend. It's getting late (here in the UK) and my brain is starting to shut down....

Integrating this process into my website is certainly the way I would prefer to go, rather than clunky batch processing methods. Thanks for all the help so far and the offer to assist with ExifTools if I hit problems there.  Smiley

David   
Logged
David Anderson
Sr. Member
****
Posts: 287


View Profile
« Reply #5 on: November 03, 2008, 04:23:07 AM »

I successfully invoked ExifTool from my ASP.NET application and wrote information into the metadata of some image files - but this only worked during a test confined to my own PC. When I tried the same thing on my live website it failed with a Security Exception error. It turns out that to do this sort of thing, you need ASP.NET to be running in what is called 'Full Trust' mode. Unfortunately, ISPs do not normally allow this in a shared hosting environment. My ISP restricts ASP.NET to 'Medium Trust' for shared hosting. Dedicated server hosting is an unaffordable option for me.

It's beginning to look as if I will have to do my metadata updates as a batch process after downloading my images from the webserver, which is rather annoying.

David
Logged
rogerhoward
Full Member
***
Posts: 103


View Profile Email
« Reply #6 on: November 03, 2008, 11:56:16 AM »

I'm not well-versed on ASP.NET security issues - if having a native .NET component would make this easier check out:
http://www.chilkatsoft.com/xmp-dotnet.asp
Logged

-----

Roger Howard
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!