Bug #892
-T does not seem to have an effect
100%
Description
This is on Ubuntu 12.10, exiv2 0.23 001700 (64 bit build).
Either I do not understand the -T option or it does not work.
I have a scanned picture and I want to have Exif.Image.DateTime and Image timestamp set. I do set the Exif.Image.DateTime:
exiv2 -g Exif.Image.DateTime -Pv photo.jpg
2004:06:20 00:00:00
Then I verify there is no timestamp:
exiv2 photo.jpg
File name : photo.jpg
File size : 171249 Bytes
MIME type : image/jpeg
Image size : 1100 x 1680
Camera make :
Camera model :
Image timestamp :
Image number :
Exposure time :
Aperture :
Exposure bias :
Flash :
Flash bias :
Focal length :
Subject distance:
ISO speed :
Exposure mode :
Metering mode :
Macro mode :
Image quality :
Exif Resolution :
White balance :
Thumbnail : None
Copyright :
Exif comment :
I try to update the timestamp:
exiv2 -T -v photo.jpg
File 1/1: photo.jpg
Updating timestamp to 2004:06:20 00:00:00
However, when I try to verify whether it was updated, it seems it has not:
exiv2 photo.jpg
File name : photo.jpg
File size : 171249 Bytes
MIME type : image/jpeg
Image size : 1100 x 1680
Camera make :
Camera model :
Image timestamp :
Image number :
Exposure time :
Aperture :
Exposure bias :
Flash :
Flash bias :
Focal length :
Subject distance:
ISO speed :
Exposure mode :
Metering mode :
Macro mode :
Image quality :
Exif Resolution :
White balance :
Thumbnail : None
Copyright :
Exif comment :
History
Updated by Robin Mills over 8 years ago
Tomáš
Thank you for using exiv2 and bringing your concern to our attention. I believe the purpose of the -T option is to set the time-stamp in the filesystem from the metadata in the image. Here's what I see on Cygwin:
518 rmills@nv10042:~ $ exiv2 -pt ~/foo.jpg | grep Date Exif.Image.DateTime Ascii 20 2012:08:07 16:00:28 Exif.Photo.DateTimeOriginal Ascii 20 2009:12:29 08:34:12 Exif.Photo.DateTimeDigitized Ascii 20 2009:12:29 08:34:12 519 rmills@nv10042:~ $ touch ~/R.jpg 520 rmills@nv10042:~ $ ls -alt ~/R.jpg -rwxr-xr-x 1 rmills Domain Users 2205140 Mar 13 09:52 /home/rmills/R.jpg 521 rmills@nv10042:~ $ exiv2 -T ~/foo.jpg 522 rmills@nv10042:~ $ ls -alt ~/foo.jpg -rwxr-xr-x 1 rmills Domain Users 2205140 Dec 29 2009 /home/rmills/foo.jpg 523 rmills@nv10042:~ $So it doesn't add metadata to the image, it changes the timestamp on the disk.
If you want to add new metadata to the image, you can add modify and change tags. For example:
525 rmills@nv10042:~ $ exiv2 -M"set Exif.Image.DateTime 2013-03-13 10:09" foo.jpg 533 rmills@nv10042:~ $ exiv2 -pt foo.jpg | grep -i time Exif.Image.DateTime Ascii 17 2013-03-13 10:09 Exif.Photo.ExposureTime Rational 1 1/200 s Exif.Photo.DateTimeOriginal Ascii 20 2009:12:29 08:34:12 Exif.Photo.DateTimeDigitized Ascii 20 2009:12:29 08:34:12 Exif.CanonCs.Selftimer Short 1 Off Exif.CanonCs.DriveMode Short 1 Single / timer 534 rmills@nv10042:~ $
If you want to write a tag such as Exif.Image.DateTime from the timestamp on the filesystem, I think you'll need a script or batch file to do that.
If you'd like me to write the script or batch file, please attach a file and details of your platform (Windows/Mac/Linux/Cygwin/MinGW) and the version of exiv2 being used. You can find the version with the command: exiv2 --version
If I've haven't understood what you want, please explain again and I'll try to help.
Updated by Tomáš Hnyk over 8 years ago
Thanks for the quick reply. Oh, i see, and it is even in the man page, it talks about "file timestamp". Mea culpa.
I would actually want to set the "Image timestamp :" in the output of exiv2 foo.jpg but I am unable to find how to do it, exiv2 -M"set Image timestamp 2013-03-13 10:09" foo.jpg throws an error on me.
Updated by Tomáš Hnyk over 8 years ago
Never mind, I need to update DateTimeOriginal: exiv2 -M"set Exif.Photo.DateTimeOriginal 2013-03-13 10:09
You can close this now, and thanks for the swift reaction!
Updated by Robin Mills over 8 years ago
- Category set to documentation
- Status changed from New to Assigned
- Assignee set to Robin Mills
- Target version set to 0.24
- % Done changed from 0 to 100
- Estimated time set to 1.00 h
You've got it!
When you use the command $ exiv2 foo.jpg, it prints a sanitized list of the metadata, so it shows the date as:
Image timestamp : 2009:12:29 08:34:12However when you use $ exiv2 -pt foo.jpg, it shows the "real" keys:
509 rmills@nv10042:~ $ exiv2 -pt foo.jpg | grep -i date Exif.Image.DateTime Ascii 17 2013-03-13 10:09 Exif.Photo.DateTimeOriginal Ascii 20 2009:12:29 08:34:12 Exif.Photo.DateTimeDigitized Ascii 20 2009:12:29 08:34:12 510 rmills@nv10042:~ $You'll need to use "real" keys to set metadata.
Updated by Robin Mills over 8 years ago
- Status changed from Resolved to Closed
I'm going to close this one now. No code change required. This issue only required explaining to Tomáš how the -T option works. So, not a bug!