News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Deleting corrupted comments?

Started by terrypin, March 30, 2013, 05:20:02 AM

Previous topic - Next topic

terrypin

As I mentioned a while ago, my image editor PaintShop Pro either deletes all metadata or corrupts it whenever the file is saved (even wih no editing). So I have many hundreds of JPGs with a Comment field that now looks like this example (a direct paste from EXifTool output):

Ð.r............................. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~.€,ƒ,,...†‡ˆ‰Š‹ŒŽ''""•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ        -       -

I'm struggling with this one, so would appreciate help in how to delete all such comments from a folder and its subfolders please.

Edit: Just trying this based on an example in the documentation:

exiftool -exif:all= -tagsfromfile @ -all:all -unsafe -r <FOLDER>

At first it seemed to work, but now getting no changes. Will post again if I sort it...


--
Terry, East Grinstead, UK

Phil Harvey

Hi Terry,  The command you posted will repair any structural damage to the metadata.  However, it is possible that the comments may contain garbage even if the structure is OK.  In this case, deleting the comments may be the only option, but you will have to be careful not to do this for files where the comments are OK.

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

terrypin

Thanks Phil. Coming at it differently, could you give me a basic example of how I could delete a comment IF it contained say <char 1> AND <char 2> please? I'd then write a string of these IFs (specifying several comonly occurring non-printable characters), which I'm sure would get rid of most of the bad comments.

Terry, East Grinstead, UK

Phil Harvey

Hi Terry,

Here is the command:

exiftool -if "$comment =~ /X/ and $comment =~ /Y/" -comment= DIR

Where X and Y are the character strings that you want to match.  Add -r to process sub-directories too.

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

terrypin

Thanks Phil, that worked as you described. But I've abandoned that approach as the possible contents of corrupted Comments vary so widely that it's impractical.

I think I'm stuck with visual inspection and quick deletion of Comment in individual files.

--
Terry, East Grinstead, UK