Exiftool deletes APP2 ICC_Profile segment when rewriting all tags

Started by johnrellis, May 10, 2015, 06:00:51 PM

Previous topic - Next topic

johnrellis

The following command line deletes the APP2 ICC_Profile segment entirely from the photo:

exiftool -all= -tagsfromfile @ -all:all -unsafe IMG_7640-4.jpg

(See the attached file.) Is that a bug?

Some background: We're using Exiftool to rewrite the metadata of JPEGs exported by LR 6, which has two problems, an atypical layout of IFDs in the APP1 segment:
http://feedback.photoshop.com/photoshop_family/topics/lightroom-cc-jpeg-format-tripping-up-other-programs?rfm=1

and a bug in writing large amounts of XMP metadata:
http://feedback.photoshop.com/photoshop_family/topics/lightroom-6-invalid-xmp-metadata-written-to-exported-jpegs-tripping-up-reading-software

Phil Harvey

This is by design to prevent the color profile from being copied accidentally.  (The ICC_Profile is marked as "unsafe", as can be seen in the Extra tags documentation.)  So you must specify -icc_profile explicitly if you want this to be copied.

Perhaps it is an oversight, but the -unsafe shortcut doesn't include the ICC_Profile.  I'll think about adding this.

I'll read your references tomorrow when I have more time.  Thanks for these.

- 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 ($).

johnrellis


Phil Harvey

I think it is best to leave the Unsafe tag as it is (since it is documented as representing unsafe EXIF tags, and the ICC profile isn't part of EXIF), so instead I have added -icc_profile to the command in FAQ 20.

Thanks for mentioning this.

- 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 ($).

Phil Harvey

Your references describing the Adobe LR6 bugs are interesting.  In looking into this I added a few more details about the Adobe extended XMP segments to the ExifTool HtmlDump.  These additions will appear in ExifTool 9.96.

The unused bytes after the TIFF header are an aborted attempt at IFD0, and contain all the same information as the actual IFD0 (located at the end of the APP1 EXIF segment), except for the Orientation tag.

- 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 ($).

johnrellis

Thanks much for your help on this issue!

You might consider also updating the Copying Example in the application documentation: http://www.exiftool.org/exiftool_pod.html

exiftool -exif:all= -tagsfromfile @ -all:all -unsafe bad.jpg

which is where we first read about the idiom.

Phil Harvey

Hi John,

Quote from: johnrellis on May 11, 2015, 03:37:46 PM
You might consider also updating the Copying Example in the application documentation: http://www.exiftool.org/exiftool_pod.html

exiftool -exif:all= -tagsfromfile @ -all:all -unsafe bad.jpg

But it isn't necessary to copy back the ICC_Profile with this command because it deletes only EXIF tags (with -exif:all=), while the command you were using earlier deleted everything (with -all=).  So the example in the application documentation is fine as is.  (This is actually the reason why I decided against adding ICC_Profile to the Unsafe shortcut.)

- 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 ($).