[英]How do you use ImageMagick in Perl?
我試圖讓命令行等同於“識別image.png”在Perl中工作。
你是怎么做的?
謝謝。
更新:我有以下代碼
use Image::Magick;
$image = Image::Magick->new;
open(IMAGE, 'image.gif');
$image->Identify(file => \*IMAGE);
close(IMAGE);
但是得到以下錯誤:
無法在@INC中找到Image / Magick.pm(@INC包含:/ etc / perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 / usr / lib / perl5 / usr / share / perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 / usr / local / lib / site_perl。)
正如本文檔所述 ,PerlMagick有一種Identify
方法方法。
它的參數是: file=>file, features=>distance, unique=>{True, False}
所以它可以這樣使用( 測試 ):
use Image::Magick;
$image = Image::Magick->new;
open(IMAGE, 'image.gif');
$image->Read(file => \*IMAGE);
close(IMAGE);
$image->Identify();
如果您只需要尺寸:
use Image::Magick;
$image = Image::Magick->new;
my ($width, $height, $size, $format) = $image->Ping('image.gif');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.