Preservation of the original metadata

Started by promike, May 05, 2023, 05:15:07 AM

Previous topic - Next topic

promike

Hi

Unfortunately, I am lost in all the information.
I have a lot of vacation pictures that I would like to keep the metadata of.
Unfortunately, when I export them with photoshop, sometimes everything gets lost.
The original date and time is very important to me, because if I edit the file then only the date and time of the edit is left.

The first time I tried it just like this: exiftool -tagsFromFile original.jpg modified.jpg
But everything got mixed up

Then I tried it this way: exiftool -tagsFromFile original.jpg "-all:all" modified.jpg
A lot of metadata was present in the file. Unfortunately, the original layout was still not preserved, but since I didn't know any better, I used this one.

Should I apply this before copying tags?
exiftool -ext jpg -all= --icc_profile:all -tagsfromfile @ -colorspacetags
(All my pictures are saved in sRGB)

So the reason I'm writing this is that yesterday I noticed something was wrong; the thumbnail didn't match the image.
I didn't know that jpeg images came with a thumbnail. I thought that was generated by the OS.

I've managed to fix that with this line
exiftool -ifd1:all= -ext jpg

I suppose I don't need to run 3 commands to get my images with the original metadata.
How can I keep all the valuable information?

Of course, I wouldn't copy the original thumbnail and the colorspace if they change.

StarGeek

Quote from: promike on May 05, 2023, 05:15:07 AMUnfortunately, when I export them with photoshop, sometimes everything gets lost.
The original date and time is very important to me, because if I edit the file then only the date and time of the edit is left.

I'm assuming you're using Windows.

This is probably a FAQ #3. The command in FAQ #3 will give you all the data from the files and you would compare the before and after output to see what is different.

Odds are you are looking at the file system time stamps, FileCreateDate/FileModifyDate.  As you can see, these are fragile and really shouldn't be relied on. 

Instead, you should be looking at the "Date Taken" and "Media Created" properties.  These properties read data directly from the file

But below is how to change the system times

QuoteThe first time I tried it just like this:
exiftool -tagsFromFile original.jpg modified.jpg
But everything got mixed up

Lightroom should be preserving the embedded data. So the best option is to copy from the embedded data to the system time stamps.  This command should work for both images and videos
exiftool -api QuickTimeUTC "-FileModifyDate<CreateDate" "-FileModifyDate<DateTimeOriginal" /path/to/files/

QuoteShould I apply this before copying tags?
exiftool -ext jpg -all= --icc_profile:all -tagsfromfile @ -colorspacetags
(All my pictures are saved in sRGB)

This is a bad idea. I would never suggest removing data with -All= when you actually want to keep the data.

QuoteSo the reason I'm writing this is that yesterday I noticed something was wrong; the thumbnail didn't match the image.
I didn't know that jpeg images came with a thumbnail. I thought that was generated by the OS.

I would have thought that Lightroom would have updated the thumb, but I've never tested it.

QuoteI've managed to fix that with this line
exiftool -ifd1:all= -ext jpg

If you really want to remove the thumbnail, I would suggest just removing it rather than the whole block.  Usually, IFD1 is thumbnail data, but some camera companies write other data here and in some other cases depending upon the file type, this could remove important data.
exiftool -thumbnailimage= /path/to/files/

Exiftool can replace a thumbnail, but since it doesn't manipulate image data, you would have to use something else to make a new thumbnail jpeg before using exiftool to replace the thumbnail.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

promike

Thank you for your response and your efforts to help me.
Your informative reply was greatly appreciated

I use Linux as my operating system, not Windows.
The metadata tools and techniques you suggested may not be applicable in my case
I usually check metadata by typing exiftool in the command line, or I use KDE's capabilities, such as the Dolphin file manager or Gwenview.

I would copy as many details as possible from the original file, not just the original creation time.

Original file:
ExifTool Version Number         : 12.60
File Name                       : P1200001.JPG
Directory                       : .
File Size                       : 4.4 MB
File Modification Date/Time     : 2023:03:10 12:02:36+01:00
File Access Date/Time           : 2023:05:07 22:33:58+02:00
File Inode Change Date/Time     : 2023:05:07 22:33:58+02:00
File Permissions                : -rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Image Description               : OLYMPUS DIGITAL CAMERA
Make                            : OLYMPUS IMAGING CORP.
Camera Model Name               : SP-720UZ
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : Version 1.0
Modify Date                     : 2023:02:16 03:55:15
Y Cb Cr Positioning             : Co-sited
Exposure Time                   : 1/400
F Number                        : 3.2
Exposure Program                : Program AE
ISO                             : 100
Sensitivity Type                : Standard Output Sensitivity
Exif Version                    : 0230
Date/Time Original              : 2023:02:16 03:55:15
Create Date                     : 2023:02:16 03:55:15
Components Configuration        : Y, Cb, Cr, -
Exposure Compensation           : 0
Max Aperture Value              : 3.2
Metering Mode                   : Multi-segment
Light Source                    : Unknown
Flash                           : Off, Did not fire
Focal Length                    : 4.7 mm
Special Mode                    : Normal, Sequence: 0, Panorama: (none)
Camera ID                       : OLYMPUS DIGITAL CAMERA
Equipment Version               : 0100
Camera Type 2                   : SP-720UZ
Focal Plane Diagonal            : 7.74 mm
Body Firmware Version           : 1.004
Camera Settings Version         : 0100
Preview Image Valid             : Yes
Preview Image Start             : 4256142
Preview Image Length            : 122003
Macro Mode                      : Off
Flash Mode                      : Off
White Balance 2                 : Auto
White Balance Bracket           : 0 0
Scene Mode                      : Standard
Magic Filter                    : Off; 0; 0; 0
Drive Mode                      : Single Shot
Panorama Mode                   : Off
Image Processing Version        : 0112
Distortion Correction 2         : On
Faces Detected                  : 0 0 0
Face Detect Area                : (Binary data 191 bytes, use -b option to extract)
Max Faces                       : 8 8 8
Face Detect Frame Size          : 0 0 0 0 0 0
Warning                         : [minor] MakerNotes tag 0x6000 IFD format not handled
User Comment                    :
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 4288
Exif Image Height               : 2416
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
File Source                     : Digital Camera
Custom Rendered                 : Normal
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : 0
Focal Length In 35mm Format     : 26 mm
Scene Capture Type              : Standard
Gain Control                    : None
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
PrintIM Version                 : 0300
Compression                     : JPEG (old-style)
Thumbnail Offset                : 2418
Thumbnail Length                : 9491
Image Width                     : 4288
Image Height                    : 2416
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
Aperture                        : 3.2
Image Size                      : 4288x2416
Megapixels                      : 10.4
Preview Image                   : (Binary data 122003 bytes, use -b option to extract)
Scale Factor To 35 mm Equivalent: 5.6
Shutter Speed                   : 1/400
Thumbnail Image                 : (Binary data 9491 bytes, use -b option to extract)
Circle Of Confusion             : 0.005 mm
Field Of View                   : 69.4 deg
Focal Length                    : 4.7 mm (35 mm equivalent: 26.0 mm)
Hyperfocal Distance             : 1.26 m
Light Value                     : 12.0

the metadata of the same file changes after I exported it from Photoshop:
ExifTool Version Number         : 12.60
File Name                       : P1200001b.jpg
Directory                       : .
File Size                       : 3.7 MB
File Modification Date/Time     : 2023:05:07 22:43:03+02:00
File Access Date/Time           : 2023:05:07 22:43:02+02:00
File Inode Change Date/Time     : 2023:05:07 22:43:01+02:00
File Permissions                : -rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
DCT Encode Version              : 100
APP14 Flags 0                   : [14], Encoded with Blend=1 downsampling
APP14 Flags 1                   : (none)
Color Transform                 : YCbCr
Image Width                     : 4288
Image Height                    : 2416
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Image Size                      : 4288x2416
Megapixels                      : 10.4

or with the save as option:
ExifTool Version Number         : 12.60
File Name                       : P1200001c.jpg
Directory                       : .
File Size                       : 1149 kB
File Modification Date/Time     : 2023:05:07 22:43:49+02:00
File Access Date/Time           : 2023:05:07 22:43:50+02:00
File Inode Change Date/Time     : 2023:05:07 22:43:49+02:00
File Permissions                : -rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Photometric Interpretation      : RGB
Image Description               : OLYMPUS DIGITAL CAMERA
Make                            : OLYMPUS IMAGING CORP.
Camera Model Name               : SP-720UZ
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 3
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : Adobe Photoshop CC 2019 (Windows)
Modify Date                     : 2023:05:07 22:43:44
Y Cb Cr Positioning             : Co-sited
PrintIM Version                 : 0300
Exposure Time                   : 1/400
F Number                        : 3.2
Exposure Program                : Program AE
ISO                             : 100
Sensitivity Type                : Standard Output Sensitivity
Exif Version                    : 0230
Date/Time Original              : 2023:02:16 03:55:15
Create Date                     : 2023:02:16 03:55:15
Components Configuration        : Y, Cb, Cr, -
Shutter Speed Value             : 1/400
Aperture Value                  : 3.2
Exposure Compensation           : 0
Max Aperture Value              : 3.2
Metering Mode                   : Multi-segment
Light Source                    : Unknown
Flash                           : Off, Did not fire
Focal Length                    : 4.7 mm
User Comment                    :
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 4288
Exif Image Height               : 2416
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
File Source                     : Digital Camera
Custom Rendered                 : Normal
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : 0
Focal Length In 35mm Format     : 26 mm
Scene Capture Type              : Standard
Gain Control                    : None
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
Compression                     : JPEG (old-style)
Thumbnail Offset                : 1726
Thumbnail Length                : 2305
Current IPTC Digest             : 6da7b9954ab0f3465c46daf621338af5
Application Record Version      : 0
Caption-Abstract                : OLYMPUS DIGITAL CAMERA
Time Created                    : 03:55:15+00:00
IPTC Digest                     : 6da7b9954ab0f3465c46daf621338af5
Displayed Units X               : inches
Displayed Units Y               : inches
Print Style                     : Centered
Print Position                  : 0 0
Print Scale                     : 1
Global Angle                    : 30
Global Altitude                 : 30
URL List                        :
Slices Group Name               : P1200001
Num Slices                      : 1
Pixel Aspect Ratio              : 1
Photoshop Thumbnail             : (Binary data 2305 bytes, use -b option to extract)
Has Real Merged Data            : Yes
Writer Name                     : Adobe Photoshop
Reader Name                     : Adobe Photoshop CC 2019
Photoshop Quality               : 10
Photoshop Format                : Standard
XMP Toolkit                     : Adobe XMP Core 5.6-c145 79.163499, 2018/08/13-16:40:22
Format                          : image/jpeg
Creator Tool                    : Version 1.0
Metadata Date                   : 2023:05:07 22:43:44+02:00
Date Created                    : 2023:02:16 03:55:15
Color Mode                      : RGB
ICC Profile Name                : sRGB IEC61966-2.1
Document ID                     : adobe:docid:photoshop:e652a5e0-c9a4-fb45-a2dd-42f53510a8af
Instance ID                     : xmp.iid:5e245169-f94b-3943-aaab-a8f10098b776
Original Document ID            : 25776C7FC7606ED30DBFA433B38AF132
Description                     : OLYMPUS DIGITAL CAMERA
History Action                  : saved, saved
History Instance ID             : xmp.iid:645336cb-615a-1544-94e4-e736a11db969, xmp.iid:5e245169-f94b-3943-aaab-a8f10098b776
History When                    : 2023:05:07 22:43:44+02:00, 2023:05:07 22:43:44+02:00
History Software Agent          : Adobe Photoshop CC 2019 (Windows), Adobe Photoshop CC 2019 (Windows)
History Changed                 : /, /
Profile CMM Type                : Linotronic
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 1998:02:09 06:49:00
Profile File Signature          : acsp
Primary Platform                : Microsoft Corporation
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : Hewlett-Packard
Device Model                    : sRGB
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : Hewlett-Packard
Profile ID                      : 0
Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
Profile Description             : sRGB IEC61966-2.1
Media White Point               : 0.95045 1 1.08905
Media Black Point               : 0 0 0
Red Matrix Column               : 0.43607 0.22249 0.01392
Green Matrix Column             : 0.38515 0.71687 0.09708
Blue Matrix Column              : 0.14307 0.06061 0.7141
Device Mfg Desc                 : IEC http://www.iec.ch
Device Model Desc               : IEC 61966-2.1 Default RGB colour space - sRGB
Viewing Cond Desc               : Reference Viewing Condition in IEC61966-2.1
Viewing Cond Illuminant         : 19.6445 20.3718 16.8089
Viewing Cond Surround           : 3.92889 4.07439 3.36179
Viewing Cond Illuminant Type    : D50
Luminance                       : 76.03647 80 87.12462
Measurement Observer            : CIE 1931
Measurement Backing             : 0 0 0
Measurement Geometry            : Unknown
Measurement Flare               : 0.999%
Measurement Illuminant          : D65
Technology                      : Cathode Ray Tube Display
Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
DCT Encode Version              : 100
APP14 Flags 0                   : [14]
APP14 Flags 1                   : (none)
Color Transform                 : YCbCr
Image Width                     : 4288
Image Height                    : 2416
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Aperture                        : 3.2
Image Size                      : 4288x2416
Megapixels                      : 10.4
Scale Factor To 35 mm Equivalent: 5.6
Shutter Speed                   : 1/400
Thumbnail Image                 : (Binary data 2305 bytes, use -b option to extract)
Date/Time Created               : 2023:02:16 03:55:15+00:00
Circle Of Confusion             : 0.005 mm
Field Of View                   : 69.4 deg
Focal Length                    : 4.7 mm (35 mm equivalent: 26.0 mm)
Hyperfocal Distance             : 1.26 m
Light Value                     : 12.0

There are huge differences between the two metadata.
Export doesn't export metadata. Save as generates a metadata file with too much information that I don't need.

It may be easier to get rid of the unwanted data than to copy them over from the original source
This is the difference
Aperture Value                  : 3.2
APP14 Flags 0                   : [14]
APP14 Flags 1                   : (none)
Application Record Version      : 0
Blue Matrix Column              : 0.14307 0.06061 0.7141
Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
Caption-Abstract                : OLYMPUS DIGITAL CAMERA
CMM Flags                       : Not Embedded, Independent
Color Mode                      : RGB
Color Space Data                : RGB
Color Transform                 : YCbCr
Connection Space Illuminant     : 0.9642 1 0.82491
Creator Tool                    : Version 1.0
Current IPTC Digest             : 6da7b9954ab0f3465c46daf621338af5
Date Created                    : 2023:02:16 03:55:15
Date/Time Created               : 2023:02:16 03:55:15+00:00
DCT Encode Version              : 100
Description                     : OLYMPUS DIGITAL CAMERA
Device Attributes               : Reflective, Glossy, Positive, Color
Device Manufacturer             : Hewlett-Packard
Device Mfg Desc                 : IEC http://www.iec.ch
Device Model Desc               : IEC 61966-2.1 Default RGB colour space - sRGB
Device Model                    : sRGB
Displayed Units X               : inches
Displayed Units Y               : inches
Document ID                     : adobe:docid:photoshop:e652a5e0-c9a4-fb45-a2dd-42f53510a8af
File Access Date/Time           : 2023:05:07 22:43:50+02:00
File Inode Change Date/Time     : 2023:05:07 22:43:49+02:00
File Modification Date/Time     : 2023:05:07 22:43:49+02:00
File Name                       : P1200001c.jpg
File Size                       : 1149 kB
Format                          : image/jpeg
Global Altitude                 : 30
Global Angle                    : 30
Green Matrix Column             : 0.38515 0.71687 0.09708
Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
Has Real Merged Data            : Yes
History Action                  : saved, saved
History Changed                 : /, /
History Instance ID             : xmp.iid:645336cb-615a-1544-94e4-e736a11db969, xmp.iid:5e245169-f94b-3943-aaab-a8f10098b776
History Software Agent          : Adobe Photoshop CC 2019 (Windows), Adobe Photoshop CC 2019 (Windows)
History When                    : 2023:05:07 22:43:44+02:00, 2023:05:07 22:43:44+02:00
ICC Profile Name                : sRGB IEC61966-2.1
Instance ID                     : xmp.iid:5e245169-f94b-3943-aaab-a8f10098b776
IPTC Digest                     : 6da7b9954ab0f3465c46daf621338af5
Luminance                       : 76.03647 80 87.12462
Measurement Backing             : 0 0 0
Measurement Flare               : 0.999%
Measurement Geometry            : Unknown
Measurement Illuminant          : D65
Measurement Observer            : CIE 1931
Media Black Point               : 0 0 0
Media White Point               : 0.95045 1 1.08905
Metadata Date                   : 2023:05:07 22:43:44+02:00
Modify Date                     : 2023:05:07 22:43:44
Num Slices                      : 1
Original Document ID            : 25776C7FC7606ED30DBFA433B38AF132
Photometric Interpretation      : RGB
Photoshop Format                : Standard
Photoshop Quality               : 10
Photoshop Thumbnail             : (Binary data 2305 bytes, use -b option to extract)
Pixel Aspect Ratio              : 1
Primary Platform                : Microsoft Corporation
Print Position                  : 0 0
Print Scale                     : 1
Print Style                     : Centered
Profile Class                   : Display Device Profile
Profile CMM Type                : Linotronic
Profile Connection Space        : XYZ
Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
Profile Creator                 : Hewlett-Packard
Profile Date Time               : 1998:02:09 06:49:00
Profile Description             : sRGB IEC61966-2.1
Profile File Signature          : acsp
Profile ID                      : 0
Profile Version                 : 2.1.0
Reader Name                     : Adobe Photoshop CC 2019
Red Matrix Column               : 0.43607 0.22249 0.01392
Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
Rendering Intent                : Perceptual
Samples Per Pixel               : 3
Shutter Speed Value             : 1/400
Slices Group Name               : P1200001
Software                        : Adobe Photoshop CC 2019 (Windows)
Technology                      : Cathode Ray Tube Display
Thumbnail Image                 : (Binary data 2305 bytes, use -b option to extract)
Thumbnail Length                : 2305
Thumbnail Offset                : 1726
Time Created                    : 03:55:15+00:00
URL List                        :
Viewing Cond Desc               : Reference Viewing Condition in IEC61966-2.1
Viewing Cond Illuminant         : 19.6445 20.3718 16.8089
Viewing Cond Illuminant Type    : D50
Viewing Cond Surround           : 3.92889 4.07439 3.36179
Writer Name                     : Adobe Photoshop
XMP Toolkit                     : Adobe XMP Core 5.6-c145 79.163499, 2018/08/13-16:40:22
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)

I'd much prefer keep the original layout but I wouldn't like to corrupt the image either.
The manual for exiftool is very well written, but I got lost in the tags section and I'm a little nervous about potentially messing up my photos
Is there a tag that covers the unnecessary data?