Skip to content

Instantly share code, notes, and snippets.

@dctabuyz
Created March 4, 2018 11:52
Show Gist options
  • Save dctabuyz/6edeb07a6f8d7c83a7ca1915bb788f70 to your computer and use it in GitHub Desktop.
Save dctabuyz/6edeb07a6f8d7c83a7ca1915bb788f70 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Module::Load 'load';
use Module::Load::Conditional 'can_load';
die 'Image::ExifTool not installed' unless can_load('modules' => {'Image::ExifTool' => 0});
load('Image::ExifTool');
my $e = Image::ExifTool->new;
my $f = shift || die 'no file specified';
die "file `$f' not found" unless ( -f $f );
die 'unable to extract exif info' unless $e->ExtractInfo($f);
printf("%30s: %s\n", $_, handle_binary($e->GetValue($_))) for ( sort $e->GetFoundTags() );
sub handle_binary
{
my $value = shift || '';
return '-- BINARY DATA, NOT PRINTED' if ( ref $value or $value =~ /[^\x20-\x7e]/ );
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment