API To Get To EXIF Data?

Discussion in 'Digital Cameras' started by (PeteCresswell), Jan 1, 2007.

  1. I have about 10,000 pix that I'd like to rename so that each file name begins
    with the date. e.g. "2003 09-27 Joe Birthday".

    Problem is that some of them are already named using that convention.

    So I'd like to write a little VB program to iterate through all the pix, look at
    the file name, and - if it doesn't begin with a date - go into the EXIF data,
    retrieve the date, and rename the file accordingly.

    I'm assuming that the various utilities that are undoubtedly available will not
    let me check the file name before doing anything.

    Anybody know of an API that will let me get to a pic's EXIF info?
    (PeteCresswell), Jan 1, 2007
    1. Advertisements

  2. (PeteCresswell)

    Cynicor Guest

    You can use VB.NET to do it. Basically, you can say:

    objImage = System.Drawing.Image.FromFile(FileName)


    Dim i As PropertyItem
    For Each i In objImage.PropertyItems

    or something similar. An i.Id value of &H9003 is the original date/time.
    Then you can convert that to the string you want, and rename the file
    with the My.Computer.FileSystem APIs or your favorite file renaming code.

    I'm working on a project now (for an upcoming magazine article) and can
    send you some source code if you're interested. Drop me a line at my
    email address (with the dots taken out).
    Cynicor, Jan 1, 2007
    1. Advertisements

  3. (PeteCresswell)

    Richard H. Guest

    You can do it with Perl using ExifTool:

    There's a command-line interface that can do this by rebuilding the name
    from scratch (not deriving it from the current name), or you can modify
    it to re-use parts of the existing name.

    There's also a new Windows version. I haven't used it, but I'd
    speculate it won't be flexible enough for this application.

    Richard H., Jan 1, 2007
  4. (PeteCresswell)

    Matt Ion Guest

    IrfanView will do the renaming in batch mode. Just set a rename pattern of
    "$E36868(%Y %m-%d) $N" (the $N retains the original filename, with extension).
    Mind you, that won't skip files that are already named properly, so you'll end
    up with a double-datestamp in them.
    Matt Ion, Jan 1, 2007
  5. (PeteCresswell)

    Dave Cohen Guest

    Use a free download renamemaster. You can simply replace the existing
    name with what you want. You may need to look at the help file for an
    example of exif data extraction. That's not so good, while the text
    (it's a web page) is readable, the example screen shots require
    microscopic eyesight and a good imagination. Still, I figured it out so
    I'm sure you'll have no problem.
    Dave Cohen
    Dave Cohen, Jan 1, 2007
  6. (PeteCresswell)

    Bruce Lewis Guest

    The ones that aren't named using that convention -- do they all start
    with a letter? If so, you can likely come up with a Unix command to do
    it, something along these lines:

    jhead -fsomething `find . -name '[a-zA-Z]*.jpg' -print`
    Bruce Lewis, Jan 2, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.