Perl - 如何使用“系统”使用 Image::Magick 调整大小和注释称呼?

发布于 2024-10-05 18:29:15 字数 1090 浏览 7 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里泪两行 2024-10-12 18:29:15

您可以阅读文档来清除 -annotate 选项的参数 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")

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")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文