perlmagick imagemagick错误
我的托管提供商最近升级了他们的服务器,我在 Perl 中的 imagemagick 脚本方面遇到了很多问题。我的脚本在旧服务器上运行得很好,但在新服务器上却失败了,所以我回到基础知识来尝试找出问题所在。
服务器将 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
且 perl 模块 Image::Magick 版本为 6.72
以下脚本保存在我的服务器上:
#!/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:-");
失败并出现以下错误:
[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.
如果我更改 ReadImage("canvas:black") 到
ReadImage("xc:black")
然后脚本连续运行,没有输出。
我的虚拟主机一直在努力寻找解决方案,但我需要知道我是否在这里做错了什么,或者 imagemagick 是否存在安装问题。
请注意,我意识到上述操作可以使用其他更简单的模块来完成,但这只是一个简单的示例,用于确定问题是 imagemagick 还是我的代码!
感谢您的帮助。
问候,
斯图
My hosting provider has recently upgraded their servers and I am having lots of problems with imagemagick scripts in perl. 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:
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
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.
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.
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!
Thanks for your help.
Regards,
Stu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在使用 ImageMagick 版本 6.3.7 的 winxp 命令行模式下收到了类似的错误。
我将前几行更改为:
I received similar errors in winxp command line mode with version 6.3.7 of ImageMagick.
I changed the first few lines to this and it worked: