img_rewrite.pl 506 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/perl
  2. # Author: Daniel "Trizen" Șuteu
  3. # License: GPLv3
  4. # Date: 30 January 2015
  5. # Website: https://github.com/trizen
  6. # Rewrite a set of images specified as arguments.
  7. use 5.010;
  8. use strict;
  9. use warnings;
  10. use Image::Magick;
  11. foreach my $file (@ARGV) {
  12. say "** Processing file `$file'...";
  13. my $img = Image::Magick->new;
  14. $img->Read($file) && do {
  15. warn "[!] Can't load image `$file' ($!). Skipping file...\n";
  16. next;
  17. };
  18. unlink($file);
  19. $img->Write($file);
  20. }