简体   繁体   English

perlmagick imagemagick错误

[英]perlmagick imagemagick error

My hosting provider has recently upgraded their servers and I am having lots of problems with imagemagick scripts in perl. 我的托管服务提供商最近升级了他们的服务器,我在perl中的imagemagick脚本遇到了很多问题。 My script worked perfectly on the old server but fail on the new one so I have gone back to basics to try and sort out what is going wrong. 我的脚本在旧服务器上工作得很好,但在新服务器上失败了所以我已经回到基础,尝试找出问题所在。

The server reports the imagemagick as: 服务器将imagemagick报告为:

Version: ImageMagick 6.7.2-2 2011-10-20 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP

and the perl module Image::Magick is version 6.72 和perl模块Image :: Magick是版本6.72

The following script is saved on my server: 以下脚本保存在我的服务器上:

#!/usr/bin/perl 
use CGI::Carp qw( fatalsToBrowser );

use Image::Magick;

my $image = Image::Magick->new;

$x = $image -> Set(size=>"200x200");
warn "$x" if "$x";

$x = $image -> ReadImage("canvas:black");
warn "$x" if "$x";

$x = $image -> Draw (
  stroke    => "red",
  primitive => "line",
  points    => "20,20 180,180");
warn "$x" if "$x";

print "Content-type: image/gif\n\n";
binmode STDOUT;
$image -> write ("gif:-");

This fails with the following errors: 此操作失败,并出现以下错误:

[Sun Oct 23 11:02:32 2011] imtest.pl: Exception 420: no decode delegate for this image format `lack' @ error/constitute.c/ReadImage/532 at www/11/cgi-bin/imtest.pl line 12.
[Sun Oct 23 11:02:32 2011] imtest.pl: Exception 410: no images defined `Draw' @ error/Magick.xs/XS_Image__Magick_Mogrify/7394 at www/11/cgi-bin/imtest.pl line 18.

If I change ReadImage("canvas:black") to ReadImage("xc:black") then the script runs continuously with no output. 如果我将ReadImage("canvas:black")更改为ReadImage("xc:black")则脚本将连续运行而不输出。

My webhost has been great in trying to find a solution but I need to know if I am doing something wrong here, or if there is an installation problem with imagemagick. 我的webhost一直很努力寻找解决方案,但我需要知道我在这里做错了什么,或者是否存在imagemagick的安装问题。

Please note I realise the above can be done with other simpler modules but this is just a simple example to determine if the problem is imagemagick or my code! 请注意我意识到上面可以用其他更简单的模块来完成,但这只是一个简单的例子来确定问题是imagemagick还是我的代码!

Thanks for your help. 谢谢你的帮助。

Regards, 问候,

Stu 斯图

I received similar errors in winxp command line mode with version 6.3.7 of ImageMagick. 我在winxp命令行模式下使用ImageMagick的6.3.7版本收到了类似的错误。

I changed the first few lines to this and it worked: 我将前几行更改为此并且有效:

my $image = Image::Magick->new(size=>"200x200");
die "Image::Magick->new failed" unless $image;

my $x = $image->Read("xc:black");
warn "$x" if "$x";

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

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