diff --git a/tools/imagedownload.pl b/tools/imagedownload.pl new file mode 100755 index 00000000..51d73006 --- /dev/null +++ b/tools/imagedownload.pl @@ -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";