Repairing JPG metadata - XMP format error (no closing tag for x:xmpmeta)

Started by Tom2112, November 25, 2020, 01:44:14 PM

Previous topic - Next topic

Tom2112

I am format converting a bajillion images using ImageMagick - which works fabulously, by the way - but a lot of my images give corrupt XMP warnings in ImageMagick. So I turned to ExifTool to see what the problem with the metadata is.

When I run ExifTool against one of the problem images, I get this warning:
Warning                         : XMP format error (no closing tag for x:xmpmeta)

I'm new to ExifTool, so I don't know if this is possible, but can it be used to repair these XMP missing closing tag problems?

Where do I begin with this tool? Frankly, its a bit overwhelming all the stuff this thing can do! So if someone can point me in the right direction, I would appreciate it.

Thanks,
Tom

StarGeek

Try this, test it first to make sure you don't lose any data
exiftool -XMP:All -TagsFromFile @ -XMP:all /path/to/files/

This removes the XMP data and then re-inserts it, re-writing it.  The only thing to watch for is if you have some XMP tags that exiftool doesn't have any definitions for.  So test it to make sure everything is correct.

This command creates backup files.  Add -Overwrite_Original to suppress the creation of backup files.  Add -r to recurse into subdirectories.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

@StarGeek:  I don't think this will work if the XMP is corrupted like this.  I tried making a corrupted file myself and ExifTool won't do anything with the XMP in this file.  (ie. it won't read it at all, so it can't be used to repair it.)

- Phil

Edit: I would guess that there are more problems in this XMP other than just the missing </x:xmpmeta>.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Ah, I was making the assumption that Tom2112 had used exiftool to see that the data was there.  Good to know.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Tom2112

Thanks guys! I did try StarGeek's suggestion, and Phil is correct, it wouldn't work. It kept telling me that there were no writable tags set from my image file.

C:\Working>exiftool -XMP:All -TagsFromFile 021.jpg -XMP:all 021.jpg
Warning: XMP format error (no closing tag for x:xmpmeta) - 021.jpg
Warning: No writable tags set from 021.jpg
Ignored superfluous tag name or invalid option: -XMP:All
    0 image files updated
    1 image files unchanged

C:\Working>


Oddly, exiftool does read a ton of tags from the file:

C:\Working>exiftool 021.jpg
ExifTool Version Number         : 12.10
File Name                       : 021.jpg
Directory                       : .
File Size                       : 5.5 MB
File Modification Date/Time     : 2015:04:01 01:00:00-04:00
File Access Date/Time           : 2020:11:25 14:00:09-05:00
File Creation Date/Time         : 2020:11:25 13:22:18-05:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Current IPTC Digest             : 6ff0b6aabd5a2ef9842d77787d5d16db
Envelope Record Version         : 4
Coded Character Set             : UTF8
Application Record Version      : 4
Date Created                    : 2014:07:22
Time Created                    : 16:27:37+02:00
IPTC Digest                     : 6ff0b6aabd5a2ef9842d77787d5d16db
X Resolution                    : 72
Displayed Units X               : inches
Y Resolution                    : 72
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               : DarinaLSkinAndConcrete_021
Num Slices                      : 1
Pixel Aspect Ratio              : 1
Photoshop Thumbnail             : (Binary data 3682 bytes, use -b option to extract)
Has Real Merged Data            : Yes
Writer Name                     : Adobe Photoshop
Reader Name                     : Adobe Photoshop CC
Photoshop Quality               : 11
Photoshop Format                : Standard
Progressive Scans               : 3 Scans
Exif Byte Order                 : Little-endian (Intel, II)
Photometric Interpretation      : RGB
Make                            : Phase One
Camera Model Name               : IQ180
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 3
Resolution Unit                 : inches
Software                        : Adobe Photoshop CC (Macintosh)
Modify Date                     : 2014:07:22 16:27:37
Exposure Time                   : 1/200
F Number                        : 8.0
Exposure Program                : Manual
ISO                             : 50
Exif Version                    : 0220
Date/Time Original              : 2014:07:22 16:27:37
Create Date                     : 2014:07:22 16:27:37
Shutter Speed Value             : 1/200
Aperture Value                  : 8.0
Exposure Compensation           : 0
Light Source                    : Flash
Focal Length                    : 80.0 mm
Color Space                     : Uncalibrated
Exif Image Width                : 7521
Exif Image Height               : 10010
Sensing Method                  : One-chip color area
File Source                     : Digital Camera
Scene Type                      : Directly photographed
Compression                     : JPEG (old-style)
Thumbnail Offset                : 6938
Thumbnail Length                : 3682
Profile CMM Type                : Adobe Systems Inc.
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 2000:08:11 19:51:59
Profile File Signature          : acsp
Primary Platform                : Apple Computer Inc.
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : none
Device Model                    :
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : Adobe Systems Inc.
Profile ID                      : 0
Profile Copyright               : Copyright 2000 Adobe Systems Incorporated
Profile Description             : Adobe RGB (1998)
Media White Point               : 0.95045 1 1.08905
Media Black Point               : 0 0 0
Red Tone Reproduction Curve     : (Binary data 14 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 14 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 14 bytes, use -b option to extract)
Red Matrix Column               : 0.60974 0.31111 0.01947
Green Matrix Column             : 0.20528 0.62567 0.06087
Blue Matrix Column              : 0.14919 0.06322 0.74457
Warning                         : XMP format error (no closing tag for x:xmpmeta)
Image Width                     : 7513
Image Height                    : 10000
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Aperture                        : 8.0
Image Size                      : 7513x10000
Megapixels                      : 75.1
Shutter Speed                   : 1/200
Thumbnail Image                 : (Binary data 3682 bytes, use -b option to extract)
Date/Time Created               : 2014:07:22 16:27:37+02:00
Focal Length                    : 80.0 mm
Light Value                     : 14.6

C:\Working>


So I'm not sure if I can export them and then write them back or not.

Phil Harvey

I think you will find those are not XMP tags.  Add -G to the command to see where they came from.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Tom2112

Thank you Phil! You're correct. None of them were XMP. Is there any way to see the corrupted XMP information?

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).