How to retrieve date/time information from JPG file?

Discussion in 'Java' started by Wenwei Weng, Jun 16, 2004.

  1. Wenwei Weng

    Wenwei Weng Guest

    hello,

    I bought a Canon Powershot A80 digital camera. Sadly, I found out that date
    is not shown on the image. Only if I buy Canaon photo printer, the date can
    be printed on the photo. I believe it is Canon's dirty marketing strategy.

    So I decide to write a program to put the date on the image. I have almost
    completed: it take the image file name, and the date to be put on. It works
    fine. But my friend told me that the date actually can be retrieved from JPG
    image file itself, it is part of image property.

    Wondering anyone has done this. Any help will be appreciated.

    Thanks in advance.
    Wenwei
     
    Wenwei Weng, Jun 16, 2004
    #1
    1. Advertisements

  2. Wenwei Weng

    Roedy Green Guest

    t may be potentially in there, but it looks like the Canon camera has
    no clock, so don't hold your breath. A clock need to be resynched. If
    it is there, it should be obvious.
     
    Roedy Green, Jun 16, 2004
    #2
    1. Advertisements

  3. Wenwei Weng

    Wenwei Weng Guest

    The Camera manual explicitly says that "even you turn on date/time, it
    doesn't mean date/time will be shown on the image. But if you want to print
    the image, date/time can be printed. See Software Guide..."
     
    Wenwei Weng, Jun 16, 2004
    #3
  4. Wenwei Weng

    VisionSet Guest

    I think this will do that if it is in there, and I think it usually is.
    My own Canon Ixus400 images provide a host of fields to photoshop including
    date.

    javax.imageio.metadata
     
    VisionSet, Jun 16, 2004
    #4
  5. Wenwei Weng

    Roedy Green Guest

    IT could mean the printer adds the print date, or it could mean the
    date is encoded in the image, just not normally viewable. If the
    second, you are in luck.

    Try opening the image in various paint program to see if any know the
    date.
     
    Roedy Green, Jun 16, 2004
    #5
  6. Wenwei Weng

    ak Guest

    JPEG from DC contain information in EXIF format.

    You can read it with many programms (Photoshop).
    try ImageroReader library (http://reader.imagero.com)
     
    ak, Jun 16, 2004
    #6
  7. Here's a program that displays the various EXIF metadata fields,
    complete with Java source code: http://www.instituteofthefuture.org/exifomatic/
     
    Michael Borgwardt, Jun 17, 2004
    #7
  8. Wenwei Weng

    Nigel Wade Guest

    There's no conspiracy. Many picture editing packages access this
    information. Some will allow you to add it to the picture, or make it into
    a watermark.

    He is right. It's part of the Exif meta-information stored with the image.
    It typically includes exposure settings (aperture, focal length, shutter
    speed) as well as date/time, and other things I can't remember offhand.

    JAlbum has already done it all. If you want to create very nice albums,
    Web sites, thumbnails etc., JAlbum is the best place I know to start. URL
    is http://www.jalbum.net (and it's free). No source though, but it does
    have a documented API (to bring it on topic - not that I've tried it).
     
    Nigel Wade, Jun 17, 2004
    #8
  9. Wenwei Weng

    Marcel Guest

    What you're looking for (if you're still looking for it) can be found
    at

    http://www.drewnoakes.com/code/exif/

    Not only can the time be read, but also tons of other stuff (did the
    flash fire? What was the shutter speed? Were any comments added? What
    kind (make and model) of camera took the picutre? etcetcetc).

    This is also the library used by the PicL tool
    (http://picl.sourceforge.net), used to move your files around based on
    metadata. A new release is planned soon, by the way...

    Good luck!
    Marcel
     
    Marcel, Jun 28, 2004
    #9
    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.