sroller icon

Annotate picture with ImageMagick

sroller | PRO | 03/22/20 08:02:43 PM UTC | 0 ⭐ | 8308 πŸ‘οΈ | Never ⏰ | []
Perl |

1.32 KB

|

None

|

0 πŸ‘

/

0 πŸ‘Ž

#!/usr/bin/env perl
Β 
use Image::ExifTool ':Public';
use Data::Dumper;
Β 
# DOW algorithm from Sakamoto https://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week
Β 
sub dow($$$) {
Β  local ($d, $m, $y) = @_;
Β  my @wochentag = qw/Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag/;
Β  my @t = (0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4);
Β  if ($m < 3) {
Β  Β  $y = $y-1;
Β  }
Β  $i = $m - 1;
Β  return $wochentag[($y + int($y/4) - int($y/100) + int($y/400) + $t[$i] + $d) % 7];
}
Β 
@monat = qw/null Januar Februar MΓ€rz April Mai Juni Juli August September Oktober November Dezember/;
Β 
$file = $ARGV[0];
$target = $ARGV[1];
Β 
if (! -f $file) { die "$file: file not found"; }
if (! -d $target) { die "$target: directory not found"; }
Β 
$img = ImageInfo($file);
($londeg, $lonmin, $lonref) = $img->{'GPSLongitude'} =~ m/(\d+) deg (\d+)'[^NESW]+(.)/;
($latdeg, $latmin, $latref) = $img->{'GPSLatitude'} =~ m/(\d+) deg (\d+)'[^NESW]+(.)/;
($y, $m , $d, $H, $M, $S) = $img->{'DateTimeOriginal'} =~ m/(\d{4}):(\d{2}):(\d{2}) (\d{2}):(\d{2}):(\d{2})/;
$datum = dow($d, $m, $y) . ", $d. $monat[$m] $y $H:$M";
$pos = "$latdegΒ°$latmin'$latref $londegΒ°$lonmin'$lonref";
Β 
$rc = `convert -verbose $file -font \"PragmataProMono\" -gravity North -pointsize 24 -fill White -annotate +12+12 \"$datum ($pos)\" $target/$file`;
Β 
exit($?);

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    πŸ‘

    /

    πŸ‘Ž