Perl - 如何使用“系统”使用 Image::Magick 调整大小和注释称呼?
Image::Magick
system("convert $imageurl $new");
system("convert $new -geometry 480x360 -blur .8 -quality 100 $new");
上面的方法都
system("convert $imageurl $new");
system("convert $new -resize 480x360 -blur .8 -quality 100 $new");
工作得很好,但是,我没有看到几何形状和调整大小之间存在明显的差异。仔细阅读它,在我的头脑中,它很有效,我会一边走一边学习。
对于注释,下面的工作正常:(
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;
上面示例中的 $vars 显然是之前声明的。)
我想做的是将其全部合并到一个更短的例程中。
就像:
system("convert $new -geometry 480x360 -blur .8 -quality 100 -annotate -text testies123 -font Candice -fill blue -pointsize 14 -gravity SouthEast -x 5 -y 5 $new");
我尝试了上面的几种变体,也只是尝试通过 system() 进行注释,但是,我只是无法弄清楚这一点。
也许还有更好的方法? 预先感谢您教这只老狗另一个技巧。
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("convert $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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以阅读文档来清除
-annotate
选项的参数 http://www.imagemagick.org/script/command-line-options.php#annotateYou may read documentation to clear arguments of
-annotate
option http://www.imagemagick.org/script/command-line-options.php#annotate