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
    (PeteCresswell), Jan 1, 2007
    #1
    1. Advertising

  2. (PeteCresswell)

    Cynicor Guest

    (PeteCresswell) wrote:
    > 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?


    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. Advertising

  3. (PeteCresswell)

    Richard H. Guest

    (PeteCresswell) wrote:
    > Anybody know of an API that will let me get to a pic's EXIF info?


    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

    In article <>, PeteCresswell
    <> wrote:

    > 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?


    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

    (PeteCresswell) wrote:
    > 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?


    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

    (PeteCresswell) wrote:
    > 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?
    >
    >


    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,

    > Anybody know of an API that will let me get to a pic's EXIF info?


    Check out the FreeImage library. Freeimage.org I think it is. You can
    retrieve exif with it.

    Best regards,

    --
    Arnor Baldvinsson
    San Antonio, Texas
    Arnor Baldvinsson, Jan 1, 2007
    #7
  8. (PeteCresswell)

    Bruce Lewis Guest

    "(PeteCresswell)" <> writes:

    > 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.


    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`

    --

    http://ourdoings.com/ Easily organize and disseminate news and
    photos for your family or group.
    Bruce Lewis, Jan 2, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henrik2000

    Show exif data as text within picture

    Henrik2000, Jul 19, 2003, in forum: Digital Photography
    Replies:
    3
    Views:
    1,962
    Henrik2000
    Jul 21, 2003
  2. S f S

    how to rip out/delete EXIF data from picture file

    S f S, Jul 31, 2003, in forum: Digital Photography
    Replies:
    16
    Views:
    46,654
    Photozaur
    Feb 13, 2011
  3. Chris McBrien

    Pentax Optio 330 - EXIF data

    Chris McBrien, Aug 28, 2003, in forum: Digital Photography
    Replies:
    1
    Views:
    326
    Lee Lindquist
    Aug 29, 2003
  4. Terry Pinnell

    When does EXIF data get lost?

    Terry Pinnell, Nov 12, 2004, in forum: Digital Photography
    Replies:
    8
    Views:
    1,064
    Terry Pinnell
    Nov 14, 2004
  5. =?Utf-8?B?TGVv?=
    Replies:
    0
    Views:
    644
    =?Utf-8?B?TGVv?=
    Sep 5, 2007
Loading...

Share This Page