简体   繁体   English

Perl ImageMagick:如何禁用命令 output 的打印?

[英]Perl ImageMagick: how to disable printing of command output?

I have a Perl script:我有一个 Perl 脚本:

#!/usr/bin/perl

use strict;

use Image::Magick;

my $temp_filename = 'temp.webp';

my $im = Image::Magick->new;
my $m = $im->Read($temp_filename);

When I run it from the command line, I get:当我从命令行运行它时,我得到:

$ perl test.cgi
Decoded /tmp/magick-324583Dvjs7UCnJGp. Dimensions: 450 x 300. Now saving...
Saved file /tmp/magick-324589ZiUphKo482g
$

I expect (and want):我期望(并且想要):

$ perl test.cgi
$

What gives?是什么赋予了?

Adding添加

$im->SetAttribute(quiet=>1);

fixed this issue for me.为我解决了这个问题。

Final script:最终脚本:

#!/usr/bin/perl

use strict;

use Image::Magick;

my $temp_filename = 'temp.webp';

my $im = Image::Magick->new;
$im->SetAttribute(quiet=>1);
my $m = $im->Read($temp_filename);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM