mirror of
https://github.com/Fishwaldo/open-zwave.git
synced 2025-03-15 19:41:36 +00:00
Add Small Perl Script to download and resize images
This commit is contained in:
parent
2723540bbb
commit
5c106c608d
1 changed files with 19 additions and 0 deletions
19
tools/imagedownload.pl
Executable file
19
tools/imagedownload.pl
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use Image::Resize;
|
||||
use File::Fetch;
|
||||
use POSIX;
|
||||
use open qw/ :std :encoding(utf-8) /;
|
||||
|
||||
BEGIN { $| = 1; }
|
||||
|
||||
my $imgurl = $ARGV[0];
|
||||
print "Downloading $imgurl....";
|
||||
my $download = File::Fetch->new(uri => $imgurl);
|
||||
my $file = $download->fetch() or die $download->error;
|
||||
File::Copy::move($file, 'productimage.png');
|
||||
print "Done\n\nResizing....";
|
||||
my $img = Image::Resize->new('productimage.png');
|
||||
my $gd = $img->resize(200,200);
|
||||
$gd->_file('productimage.png');
|
||||
print "Done\n\nSaved as productimage.png\n";
|
Loading…
Add table
Reference in a new issue