Perl - How do I resize and annotate with Image::Magick with a "system" call?
Image::Magick
system("convert $imageurl $new");
system("convert $new -geometry 480x360 -blur .8 -quality 100 $new");
and
system("convert $imageurl $new");
system("convert $new -resize 480x360 -blur .8 -quality 100 $new");
Both the above work fine but, I don't see a visible diff between geometry and resize. Read up on it, over my head, it works so, I will learn as i go here.
For annotating, the below works fine:
my $image;
my $test_text="testies123";
$image=Image::Magick->new;
my $x=$image->Read(filename=>"$new");
$x=$image->Annotate(text=>"$test_text",font=>'Candice.ttf',fill=>'#5BADFF',pointsize=>'14',gravity=>'SouthEast', x=>5, y=>5);
$x=$image->Write(filename=>'new_file.jpg'); undef $image;
(The $vars in above examples were obviously declared previously.)
What I am trying to do is combine it all into one shorter routine.
Like:
system("co开发者_高级运维nvert $new -geometry 480x360 -blur .8 -quality 100 -annotate -text testies123 -font Candice -fill blue -pointsize 14 -gravity SouthEast -x 5 -y 5 $new");
I have tried several variations of the above and also just attempted to annotate via system() but, I just cannot figure this out.
Perhaps there is even a better way all together? Thanks in advance for teaching this old dog another trick.
You may read documentation to clear arguments of -annotate
option http://www.imagemagick.org/script/command-line-options.php#annotate
system("convert $new -geometry 480x360 -blur .8 -quality 100 -font Candice -fill blue -pointsize 14 -gravity SouthEast -annotate +5+5 testies123 $new")
精彩评论