ExifTool Forum

ExifTool => Newbies => Topic started by: erayaras on March 27, 2021, 07:33:13 AM

Title: Cannot Update Created Time Value for Some Photos
Post by: erayaras on March 27, 2021, 07:33:13 AM
Hi,

Thank you for this great tool.

I have thousands of photos(with xmp files) exported from macOS Photos app.
They don't have correct created time value.

I can perfectly update the created time with following command for some photos:
exiftool -r '-FileModifyDate<DateTimeOriginal' Subfoldered/

XMP file:
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.4.0">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about=""
            xmlns:exif="http://ns.adobe.com/exif/1.0/"
            xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
         <exif:GPSSpeedRef>K</exif:GPSSpeedRef>
         <exif:GPSSpeed>0.0</exif:GPSSpeed>
         <exif:GPSTimeStamp>2001-01-01T00:00:00Z</exif:GPSTimeStamp>
         <exif:GPSImgDirection>291.39019607843136</exif:GPSImgDirection>
         <exif:GPSLongitudeRef>E</exif:GPSLongitudeRef>
         <exif:GPSAltitudeRef>0</exif:GPSAltitudeRef>
         <exif:GPSLongitude>26.637605000000001</exif:GPSLongitude>
         <exif:GPSLatitude>38.315186666666669</exif:GPSLatitude>
         <exif:GPSLatitudeRef>N</exif:GPSLatitudeRef>
         <exif:GPSImgDirectionRef>T</exif:GPSImgDirectionRef>
         <exif:GPSAltitude>45.608040201005025</exif:GPSAltitude>
         <exif:GPSHPositioningError>0.0</exif:GPSHPositioningError>
         <photoshop:DateCreated>2017-05-26T13:56:47+03:00</photoshop:DateCreated>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>



However some photos have following XMP file and their created time could not be updated:

<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.4.0">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about=""
            xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
         <photoshop:DateCreated>2017-05-27T18:23:23+03:00</photoshop:DateCreated>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>


Is there any way to update their created time value?

Thanks in advance.
Title: Re: Cannot Update Created Time Value for Some Photos
Post by: StarGeek on March 27, 2021, 10:29:50 AM
If you run exiftool on that XMP file, you'll get output like this
[ExifTool]      ExifToolVersion                 : 12.22
[System]        FileName                        : temp.xmp
[System]        Directory                       : .
[System]        FileSize                        : 375 bytes
[System]        FileModifyDate                  : 2021:03:27 07:27:01-07:00
[System]        FileAccessDate                  : 2021:03:27 07:27:01-07:00
[System]        FileCreateDate                  : 2021:03:27 07:27:01-07:00
[System]        FilePermissions                 : -rw-rw-rw-
[File]          FileType                        : XMP
[File]          FileTypeExtension               : xmp
[File]          MIMEType                        : application/rdf+xml
[XMP-x]         XMPToolkit                      : XMP Core 5.4.0
[XMP-photoshop] DateCreated                     : 2017:05:27 18:23:23+03:00


As you can see, the very last entry is a time stamp.  So you can use DateCreated instead of DateTimeOriginal for those files.
Title: Re: Cannot Update Created Time Value for Some Photos
Post by: erayaras on March 27, 2021, 12:43:52 PM
Thank you for your answer.

I used following code but It didn't work:
exiftool -r '-FileModifyDate<DateCreated' Latest/6158.jpeg

Error Message:
Warning: No writable tags set from Latest/6158.jpeg
    0 image files updated
    1 image files unchanged



I run this code for the same image:
exiftool -a -s -G Latest/6158.jpeg

I get:
[ExifTool]      ExifToolVersion                 : 12.22
[File]          FileName                        : 6158.jpeg
[File]          Directory                       : Latest
[File]          FileSize                        : 199 KiB
[File]          FileModifyDate                  : 2021:01:09 03:05:05+03:00
[File]          FileAccessDate                  : 2021:03:27 18:50:26+03:00
[File]          FileInodeChangeDate             : 2021:03:26 22:55:36+03:00
[File]          FilePermissions                 : -rw-------
[File]          FileType                        : JPEG
[File]          FileTypeExtension               : jpg
[File]          MIMEType                        : image/jpeg
[File]          ExifByteOrder                   : Big-endian (Motorola, MM)
[File]          CurrentIPTCDigest               : d41d8cd98f00b204e9800998ecf8427e
[File]          ImageWidth                      : 720
[File]          ImageHeight                     : 1280
[File]          EncodingProcess                 : Baseline DCT, Huffman coding
[File]          BitsPerSample                   : 8
[File]          ColorComponents                 : 3
[File]          YCbCrSubSampling                : YCbCr4:2:0 (2 2)
[JFIF]          JFIFVersion                     : 1.01
[JFIF]          ResolutionUnit                  : None
[JFIF]          XResolution                     : 72
[JFIF]          YResolution                     : 72
[EXIF]          Orientation                     : Horizontal (normal)
[EXIF]          XResolution                     : 72
[EXIF]          YResolution                     : 72
[EXIF]          ResolutionUnit                  : inches
[EXIF]          YCbCrPositioning                : Centered
[EXIF]          ExifVersion                     : 0221
[EXIF]          ComponentsConfiguration         : Y, Cb, Cr, -
[EXIF]          FlashpixVersion                 : 0100
[EXIF]          ColorSpace                      : sRGB
[EXIF]          ExifImageWidth                  : 720
[EXIF]          ExifImageHeight                 : 1280
[EXIF]          SceneCaptureType                : Standard
[EXIF]          Compression                     : JPEG (old-style)
[EXIF]          XResolution                     : 72
[EXIF]          YResolution                     : 72
[EXIF]          ResolutionUnit                  : inches
[EXIF]          ThumbnailOffset                 : 316
[EXIF]          ThumbnailLength                 : 8021
[EXIF]          ThumbnailImage                  : (Binary data 8021 bytes, use -b option to extract)
[Photoshop]     IPTCDigest                      : d41d8cd98f00b204e9800998ecf8427e
[Composite]     ImageSize                       : 720x1280
[Composite]     Megapixels                      : 0.922


As I mentioned in my previous post, XMP file is like that for the above image:

<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.4.0">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about=""
            xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
         <photoshop:DateCreated>2017-05-27T18:23:23+03:00</photoshop:DateCreated>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>



Also I look at to avalaible tags with following code:
exiftool -time:all -s Latest/6158.jpeg

I get:
FileModifyDate                  : 2021:01:09 03:05:05+03:00
FileAccessDate                  : 2021:03:27 19:32:35+03:00
FileInodeChangeDate             : 2021:03:26 22:55:36+03:00



I can see that DateCreated available in XMP file but not avaliable in image exif data I think(If it is make sense)


Do you have any idea how can I solve the issue?


Title: Re: Cannot Update Created Time Value for Some Photos
Post by: Phil Harvey on March 28, 2021, 12:47:06 PM
Does the XMP file have the same name as the JPEG, but with extension ".xmp"?

If so, I think you want to do this:

exiftool -tagsfromfile %d%f.xmp '-FileModifyDate<DateCreated' Latest/6158.jpeg

- Phil
Title: Re: Cannot Update Created Time Value for Some Photos
Post by: erayaras on March 29, 2021, 05:52:48 AM
This perfectly helped me. Thanks a lot!  :)