API To Get To EXIF Data?

Discussion in 'Digital Photography' 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
    1. Advertisements

  2. (PeteCresswell)

    Cynicor Guest

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

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

    then

    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
    #2
    1. Advertisements

  3. (PeteCresswell)

    Richard H. Guest

    You can do it with Perl using ExifTool:
    http://owl.phy.queensu.ca/~phil/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.

    Cheers,
    Richard
     
    Richard H., Jan 1, 2007
    #3
  4. (PeteCresswell)

    Ken Lucke Guest

    ExifTool. <http://www.sno.phy.queensu.ca/~phil/exiftool/>

    But your concern about extra work to go to if files are already named
    in that convention is probably needless - if you tell it to rename a
    file that's already named what you are attempting to change it to, it
    will either a) rename it anyway, effectively leaving it the same, or b)
    dump an error code at you which you can then ignore (depends on what
    programming language or utility you are using). Either way, you don't
    have to worry about it.

    --
    You need only reflect that one of the best ways to get yourself a
    reputation as a dangerous citizen these days is to go about repeating
    the very phrases which our founding fathers used in the struggle for
    independence.
    -- Charles A. Beard
     
    Ken Lucke, Jan 1, 2007
    #4
  5. (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
  6. (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
  7. Hi Pete,
    Check out the FreeImage library. Freeimage.org I think it is. You can
    retrieve exif with it.

    Best regards,
     
    Arnor Baldvinsson, Jan 1, 2007
    #7
  8. (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
    #8
    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.