Advertisement
hakonhagland

eixftool-update

Feb 28th, 2021
1,707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.51 KB | None | 0 0
  1. use feature qw(say);
  2. use strict;
  3. use warnings;
  4. use Image::ExifTool;
  5.  
  6. my $fn = "2.png";
  7. my $exif = Image::ExifTool->new();
  8. my $info = $exif->ImageInfo($fn);
  9. if (exists $info->{Error}) {
  10.     die "Could not extract meta information from '$fn': $info->{Error}";
  11. }
  12. say "Warning: $info->{Warning}" if exists $info->{Warning};
  13. $exif->SetNewValue(FileCreateDate => '2021:02:27 16:59:18+01:00', Protected => 1);
  14. my $res = $exif->WriteInfo($fn);
  15. die "Could not update file '$fn'" if $res == 0;
  16. say "Updated '$fn'.";
  17.  
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement