Fourth pass at adding key files
This commit is contained in:
25
site/slowtwitch.com/www/tick/scripts/thumbify.pl
Executable file
25
site/slowtwitch.com/www/tick/scripts/thumbify.pl
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/perl
|
||||
# resize to 160 on the long edge and add black border
|
||||
|
||||
use Image::Magick;
|
||||
|
||||
$source_dir = shift || ".";
|
||||
|
||||
my @allFiles;
|
||||
opendir DIR, $source_dir;
|
||||
@allFiles = grep !/^\./, readdir DIR;
|
||||
closedir DIR;
|
||||
|
||||
foreach $file (@allFiles)
|
||||
{
|
||||
if ($file =~ m/^b.*?\.jpg/g)
|
||||
{
|
||||
print "$file\n";
|
||||
$image = Image::Magick->new;
|
||||
$image->Read("$source_dir/${file}");
|
||||
$image->Resize(geometry=>"160x160");
|
||||
$image->Border(geometry=>"2x2", fill=>"black");
|
||||
$image->Write(filename=>"$source_dir/t_${file}", quality=>'75');
|
||||
undef $image;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user