magick.MagickException:无法检索句柄
上周我尝试在我的应用程序中使用 JMagick,但 sm 仍然不成功。我使用默认安装目录从源本身安装了 JMagick 6.4.0 和 ImageMagick 6.4.0。我可以在 /usr/local/lib 中看到共享库。
现在我尝试使用选项 -Djava.library.path=/usr/local/lib 运行以下程序。
public class JMagickTest {
public static void main(String[] args) {
try {
System.setProperty("jmagick.systemclassloader", "false");
System.out.println(System.getProperty("java.library.path"));
ImageInfo info = new ImageInfo("/home/blue_bg.jpg");
MagickImage image = new MagickImage(info);
System.out.println(image.getBackgroundColor());
} catch (Exception e) {
e.printStackTrace();
}
}
}
它给出以下错误。
/usr/local/lib
magick.MagickException: Unable to retrieve handle
at magick.MagickImage.getBackgroundColor(Native Method)
at JMagickTest.main(JMagickTest.java:19)
任何人都可以在这里帮助我吗?另外,请建议从系统中卸载 ImageMagick 的正确方法。
提前致谢
吉滕德拉
I am trying to use JMagick in my app for last one week but sm still unsuccesfull. I installed JMagick 6.4.0 and ImageMagick 6.4.0 from source itself using default installation directories. I can see shared libraries in /usr/local/lib.
Now I try to run following program with option -Djava.library.path=/usr/local/lib
.
public class JMagickTest {
public static void main(String[] args) {
try {
System.setProperty("jmagick.systemclassloader", "false");
System.out.println(System.getProperty("java.library.path"));
ImageInfo info = new ImageInfo("/home/blue_bg.jpg");
MagickImage image = new MagickImage(info);
System.out.println(image.getBackgroundColor());
} catch (Exception e) {
e.printStackTrace();
}
}
}
It gives following error.
/usr/local/lib
magick.MagickException: Unable to retrieve handle
at magick.MagickImage.getBackgroundColor(Native Method)
at JMagickTest.main(JMagickTest.java:19)
Could any one please help me here. Also Could some please suggest proper way to uninstall ImageMagick from system.
Thanks in advance
Jitendra
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最后我发现了错误。
我认为,无法检索句柄是一个非常普遍的错误,可能由于多种原因而发生。其中之一可能是 Imagemagick 的多个安装。
我的错误是,未安装 JPEG 格式的委托库。所以我按照 http://blog.ericlamb.net/2008/11/fix-for-convert-no-decode-delegate-for-this-image-format/ 首先安装此库,然后重新安装 imagemagick。它解决了问题。
Finally I found out the error.
I think, Unable to retrieve handle is a very generic error which may occur due to variety of reasons. One could be multiple installations of Imagemagick.
Error in my case was, delegate library for JPEG format was not installed. so I followed instructions on http://blog.ericlamb.net/2008/11/fix-for-convert-no-decode-delegate-for-this-image-format/ to first install this library then re install imagemagick. It solved the problem.
Google 似乎认为此错误与您的系统上有多个 ImageMagick 副本有关,并且当它尝试检索处理程序时会感到困惑。我怀疑 JMagick 将 ImageMagick 打包到其中,这可能就是重复的来源。
Google seems to think that this error relates to you having multiple copies of ImageMagick on your system and it is getting confused when it tries to retrieve a handler. I would suspect that JMagick packages ImageMagick into it and that would possibly be where the duplication is coming from.