Updating EXIF information in jpeg file

Discussion in 'Digital Photography' started by aurelien, Aug 31, 2004.

  1. aurelien

    aurelien Guest

    Hello everyone,
    I've wrote some code to read the Orientation tags in the EXIF data of my
    digital camera picture. I'm using libexif. Reading this tag work fine but I
    would like to have a look at a code which show how change this tag. If
    someone can help me ... :)

    --
    Aurélien
     
    aurelien, Aug 31, 2004
    #1
    1. Advertising

  2. aurelien

    BluDog Guest

    On Tue, 31 Aug 2004 15:44:04 +0200, "aurelien" <>
    wrote:

    >Hello everyone,
    >I've wrote some code to read the Orientation tags in the EXIF data of my
    >digital camera picture. I'm using libexif. Reading this tag work fine but I
    >would like to have a look at a code which show how change this tag. If
    >someone can help me ... :)


    Hi, I'm currently working on something similar. It seems pretty tricky
    but possible. What are you coding in?
     
    BluDog, Aug 31, 2004
    #2
    1. Advertising

  3. aurelien

    aurelien Guest

    I'm coding a very simple program in C. Its purpose is to look for the exif
    orientation tag and if different from 1 rotate the picture and reset the tag
    to 1. The read operation and the rotation work fine but I don't know how to
    write a new tag using libexif :(

    "BluDog" <> a écrit dans le message de
    news:...
    > On Tue, 31 Aug 2004 15:44:04 +0200, "aurelien" <>
    > wrote:
    >
    > >Hello everyone,
    > >I've wrote some code to read the Orientation tags in the EXIF data of my
    > >digital camera picture. I'm using libexif. Reading this tag work fine but

    I
    > >would like to have a look at a code which show how change this tag. If
    > >someone can help me ... :)

    >
    > Hi, I'm currently working on something similar. It seems pretty tricky
    > but possible. What are you coding in?
     
    aurelien, Aug 31, 2004
    #3
  4. aurelien

    James Fisher Guest

    http://www.sentex.net/~mwandel/jhead/

    aurelien wrote:
    > Hello everyone,
    > I've wrote some code to read the Orientation tags in the EXIF data of my
    > digital camera picture. I'm using libexif. Reading this tag work fine but I
    > would like to have a look at a code which show how change this tag. If
    > someone can help me ... :)
    >
     
    James Fisher, Sep 1, 2004
    #4
  5. aurelien

    aurelien Guest

    It's using jpegtran. I've already try this program and it doesn't work on my
    (any?) picture... :(

    "James Fisher" <> a écrit dans le message de
    news:...
    > http://www.sentex.net/~mwandel/jhead/
    >
    > aurelien wrote:
    > > Hello everyone,
    > > I've wrote some code to read the Orientation tags in the EXIF data of my
    > > digital camera picture. I'm using libexif. Reading this tag work fine

    but I
    > > would like to have a look at a code which show how change this tag. If
    > > someone can help me ... :)
    > >
     
    aurelien, Sep 1, 2004
    #5
  6. aurelien

    Jürgen Eidt Guest

    "aurelien" <> schrieb
    > It's using jpegtran. I've already try this program and it doesn't work on

    my
    > (any?) picture... :(


    Does your picture start with 0xffd8ffe1 ?
    The jpegtran code checks for a APP1 section first.
    Some apps out there still add a APP0 section in front of the EXIF block
    which is not supported by jpegtran (its not supported because its invalid to
    have both APP0 and APP1).
    Maybe you can post a link to one of your sample files?
    (Your picture file is writeable? Sometimes files are copied from CD and the
    read only attribute is set.)

    --
    Regards
    Jürgen

    http://cpicture.de/en
     
    Jürgen Eidt, Sep 1, 2004
    #6
  7. aurelien

    aurelien Guest

    Ok let's go for an example
    I've take this script and source code:
    http://sylvana.net/jpegcrop/exif_orientation.html
    The test picture is http://gallery.sig-kill.org/scripts/album24/IMG_0442

    First I check the file isn't read only for me:
    sz@deviance[~/tmp_pic] ll IMG_0442.jpg
    -rw-r--r-- 1 sz sz 576722 Sep 1 18:20 IMG_0442.jpg

    Then I use the "jpegexiforient" program to know the orientation tag:
    sz@deviance[~/tmp_pic] ./jpegexiforient IMG_0442.jpg
    6

    With my program now:
    sz@deviance[~/tmp_pic] ./exiforienttag .
    orientation for ./IMG_0442.jpg: 6

    Now I use exifautotran.sh to rotate the picture and update the tag:
    sz@deviance[~/tmp_pic] ./exifautotran.sh .
    Executing "jpegtran -copy all -rotate 90 IMG_0442.jpg > tempfile"

    The file has been rotated but if we check again the tag:
    sz@deviance[~/tmp_pic] ./exiforienttag .
    orientation for ./IMG_0442.jpg: 6
    sz@deviance[~/tmp_pic] ./jpegexiforient IMG_0442.jpg

    The tag is unchanged and jpegexiforient doesn't find it anymore...

    I hope it will help you find a way for me to update this tag with libexif :)

    Aurelien

    "Jürgen Eidt" <> a écrit dans le message de
    news:...
    > "aurelien" <> schrieb
    > > It's using jpegtran. I've already try this program and it doesn't work

    on
    > my
    > > (any?) picture... :(

    >
    > Does your picture start with 0xffd8ffe1 ?
    > The jpegtran code checks for a APP1 section first.
    > Some apps out there still add a APP0 section in front of the EXIF block
    > which is not supported by jpegtran (its not supported because its invalid

    to
    > have both APP0 and APP1).
    > Maybe you can post a link to one of your sample files?
    > (Your picture file is writeable? Sometimes files are copied from CD and

    the
    > read only attribute is set.)
    >
    > --
    > Regards
    > Jürgen
    >
    > http://cpicture.de/en
    >
    >
     
    aurelien, Sep 1, 2004
    #7
  8. aurelien

    Jürgen Eidt Guest

    "aurelien" <> schrieb

    > Ok let's go for an example
    > I've take this script and source code:
    > http://sylvana.net/jpegcrop/exif_orientation.html
    > The test picture is http://gallery.sig-kill.org/scripts/album24/IMG_0442


    > I hope it will help you find a way for me to update this tag with libexif
    > :)


    Your picture contains both a APP0 and APP1 marker which is not supported.
    Strip off the APP0 marker and it will work. To do this you can use JpegTran,
    rotate the image four times. This fixes your header.

    Quoting myself:
    >>The jpegtran code checks for a APP1 section first.
    >>Some apps out there still add a APP0 section in front of the EXIF block
    >>which is not supported by jpegtran (its not supported because its invalid
    >>to
    >>have both APP0 and APP1).


    --
    Regards
    Jürgen

    http://cpicture.de/en
     
    Jürgen Eidt, Sep 1, 2004
    #8
  9. aurelien

    aurelien Guest

    Thanks a lot for all.
    Bye,
    Aurélien

    "Jürgen Eidt" <> a écrit dans le message de
    news:...
    > "aurelien" <> schrieb
    >
    > > Ok let's go for an example
    > > I've take this script and source code:
    > > http://sylvana.net/jpegcrop/exif_orientation.html
    > > The test picture is http://gallery.sig-kill.org/scripts/album24/IMG_0442

    >
    > > I hope it will help you find a way for me to update this tag with

    libexif
    > > :)

    >
    > Your picture contains both a APP0 and APP1 marker which is not supported.
    > Strip off the APP0 marker and it will work. To do this you can use

    JpegTran,
    > rotate the image four times. This fixes your header.
    >
    > Quoting myself:
    > >>The jpegtran code checks for a APP1 section first.
    > >>Some apps out there still add a APP0 section in front of the EXIF block
    > >>which is not supported by jpegtran (its not supported because its

    invalid
    > >>to
    > >>have both APP0 and APP1).

    >
    > --
    > Regards
    > Jürgen
    >
    > http://cpicture.de/en
    >
    >
     
    aurelien, Sep 1, 2004
    #9
  10. aurelien

    aurelien Guest

    I've decided to write my own program to avoid this problem of APP1 section
    found in first in the file or not.
    It's seems to work pretty well, APP1 section can be the first or not it
    doesn't matter. When the orientation tag has been found it's set to 1 and
    the picture is rotated using jpegtran.
    If you're interested:
    http://www.sig-kill.org/~sz/jpegautoorient.c
    NB: I've wrote this very quickly so it's not perfect... :)

    Aurélien

    "Jürgen Eidt" <> a écrit dans le message de
    news:...
    > "aurelien" <> schrieb
    >
    > > Ok let's go for an example
    > > I've take this script and source code:
    > > http://sylvana.net/jpegcrop/exif_orientation.html
    > > The test picture is http://gallery.sig-kill.org/scripts/album24/IMG_0442

    >
    > > I hope it will help you find a way for me to update this tag with

    libexif
    > > :)

    >
    > Your picture contains both a APP0 and APP1 marker which is not supported.
    > Strip off the APP0 marker and it will work. To do this you can use

    JpegTran,
    > rotate the image four times. This fixes your header.
    >
    > Quoting myself:
    > >>The jpegtran code checks for a APP1 section first.
    > >>Some apps out there still add a APP0 section in front of the EXIF block
    > >>which is not supported by jpegtran (its not supported because its

    invalid
    > >>to
    > >>have both APP0 and APP1).

    >
    > --
    > Regards
    > Jürgen
    >
    > http://cpicture.de/en
    >
    >
     
    aurelien, Sep 2, 2004
    #10
  11. aurelien wrote:

    > I've decided to write my own program to avoid this problem of APP1 section
    > found in first in the file or not.
    > It's seems to work pretty well, APP1 section can be the first or not it
    > doesn't matter. When the orientation tag has been found it's set to 1 and
    > the picture is rotated using jpegtran.
    > If you're interested:
    > http://www.sig-kill.org/~sz/jpegautoorient.c
    > NB: I've wrote this very quickly so it's not perfect... :)
    >
    > Aurélien


    Is it possible to correct the date stored in the EXIF. I set the year wrong in
    my camera then took a stack of photos and now they don't sort properly in
    windows based on date photo taken.

    --
    Ben Thomas
    Opinions, conclusions, and other information in this message that do not
    relate to the official business of my firm shall be understood as neither
    given nor endorsed by it.
     
    =?ISO-8859-1?Q?BenOne=A9?=, Sep 2, 2004
    #11
  12. aurelien

    aurelien Guest

    You can change everything. There is a lot of program which can do this
    (under both unix-like and windows system) or you can use my code (or any
    other better :p) and modify it a bit to match your needs.

    "BenOne©" <> a écrit dans le message de
    news:qpf6hc.g0b.ln@192.168.11.2...
    > aurelien wrote:
    >
    > > I've decided to write my own program to avoid this problem of APP1

    section
    > > found in first in the file or not.
    > > It's seems to work pretty well, APP1 section can be the first or not it
    > > doesn't matter. When the orientation tag has been found it's set to 1

    and
    > > the picture is rotated using jpegtran.
    > > If you're interested:
    > > http://www.sig-kill.org/~sz/jpegautoorient.c
    > > NB: I've wrote this very quickly so it's not perfect... :)
    > >
    > > Aurélien

    >
    > Is it possible to correct the date stored in the EXIF. I set the year

    wrong in
    > my camera then took a stack of photos and now they don't sort properly in
    > windows based on date photo taken.
    >
    > --
    > Ben Thomas
    > Opinions, conclusions, and other information in this message that do not
    > relate to the official business of my firm shall be understood as neither
    > given nor endorsed by it.
    >
     
    aurelien, Sep 2, 2004
    #12
  13. Keith Sheppard, Sep 2, 2004
    #13
  14. BenOne© <> writes:

    > aurelien wrote:
    >
    > > I've decided to write my own program to avoid this problem of APP1 section
    > > found in first in the file or not.
    > > It's seems to work pretty well, APP1 section can be the first or not it
    > > doesn't matter. When the orientation tag has been found it's set to 1 and
    > > the picture is rotated using jpegtran.
    > > If you're interested:
    > > http://www.sig-kill.org/~sz/jpegautoorient.c
    > > NB: I've wrote this very quickly so it's not perfect... :)
    > > Aurélien

    >
    > Is it possible to correct the date stored in the EXIF. I set the year wrong
    > in my camera then took a stack of photos and now they don't sort properly in
    > windows based on date photo taken.


    The jhead program (http://www.sentex.net/~mwandel/jhead/) can do this with the
    -ta and -ts options:

    -ta<+|->h[:mm[:ss]]
    Adjust time by h:mm backwards or forwards. Useful when having
    taken pictures with the wrong time set on the camera, such as when
    travelling across time zones or DST changes. Dates can be adjusted
    by offsetting by 24 hours or more.

    -ts<time> Set the Exif internal time to <time>. <time> is in the format
    yyyy:mm:dd-hh:mm:ss

    --
    Michael Meissner
    email:
    http://www.the-meissners.org
     
    Michael Meissner, Sep 2, 2004
    #14
  15. Keith Sheppard wrote:

    > Feel free to try my PhotoMan (free download) which can change EXIF dates -
    > http://homepages.tesco.net/~Keith.Sheppard/photoman/home.htm
    >
    >


    Thanks, I'll take a look.

    And thanks to the other guys for the replies.

    --
    Ben Thomas
    Opinions, conclusions, and other information in this message that do not
    relate to the official business of my firm shall be understood as neither
    given nor endorsed by it.
     
    =?ISO-8859-1?Q?BenOne=A9?=, Sep 2, 2004
    #15
    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. Anthony

    Changing jpeg file timestamp based on EXIF info?

    Anthony, Jun 29, 2005, in forum: Digital Photography
    Replies:
    3
    Views:
    596
    colin.
    Jun 30, 2005
  2. Amit
    Replies:
    3
    Views:
    1,277
    Ed Ruf (REPLY to E-MAIL IN SIG!)
    Mar 17, 2006
  3. John Ortt

    Batch Updating EXIF Data

    John Ortt, Apr 24, 2007, in forum: Digital Photography
    Replies:
    11
    Views:
    538
    Michael Meissner
    Apr 26, 2007
  4. PGPS

    How to add GPS data to a JPEG file (Exif)

    PGPS, Jun 8, 2007, in forum: Digital Photography
    Replies:
    3
    Views:
    2,636
    Ron Hunter
    Jun 10, 2007
  5. James Grady

    How to ADD EXIF information to a JPEG photo

    James Grady, Jan 21, 2014, in forum: Digital Photography
    Replies:
    9
    Views:
    189
Loading...

Share This Page