Author Topic: Fixing Suspicious Offsets  (Read 1177 times)


  • Newbie
  • *
  • Posts: 2
Fixing Suspicious Offsets
« on: May 09, 2019, 11:32:48 AM »
I'm trying to figure out how to do the equivalent in Perl using Image::Exiftool to fix corrupted EXIF data.

This is the command line that fixes things up (and loses some data):
perl -exif:all= -tagsfromfile @ -exif:all -unsafe -thumbnailimage -F test1.jpg

These are the warnings I'm dealing with that cause WriteInfo to fail:
Warning                         : Suspicious IFD0 offset for Make
Warning                         : Suspicious IFD0 offset for Model
Warning                         : Bad IFD1 directory

I've tried using SetNewValuesFromFile and FixBase => '' but that doesn't seem to help.

Is there a simple recipe for doing the command-line equivalent in Perl?

Thanks for the help.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17499
    • ExifTool Home Page
Re: Fixing Suspicious Offsets
« Reply #1 on: May 09, 2019, 11:42:06 AM »
This is the equivalent to the command you mention (except that it doesn't preserve a backup file):

Code: [Select]
#!/usr/bin/perl -w
use strict;
use Image::ExifTool;

my $file = shift or die "expecting file name\n";

my $et = new Image::ExifTool;

$et->Options(FixBase => '');

$et->SetNewValue('exif:all' => undef);
$et->SetNewValuesFromFile($file, 'exif:all', 'unsafe', 'thumbnailimage');


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


  • Newbie
  • *
  • Posts: 2
Re: Fixing Suspicious Offsets
« Reply #2 on: May 09, 2019, 12:43:39 PM »
Awesome! Thanks for continuing to provide excellent support!