Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use strict; # Enforce some good programming rules
- use Image::Magick; # Module for image processing
- my $width = 800;
- my $height = 600;
- my $image = Image::Magick->new; # create object
- foreach (@ARGV) {
- opendir(DIR, $_) or die "Can't opendir $_: $!";
- while (defined(my $file = readdir(DIR))) {
- if ($file =~ m/.jpg$/i){ # skip if not a JPEG file
- my $path = "$_/$file";
- ## Image processing
- $image -> Read($path);
- $image -> Resize(width => $width,
- height => $height,
- );
- $image -> Write(filename => $path);
- undef @$image; # delete image
- }
- }
- closedir(DIR);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement