Page 1 of 1

JMagick simple image reading

Posted: 2009-09-04T00:37:31-07:00
by charan
HI,

I'm trying to use JMagick in a Java Application, on Windows, within Eclipse.
The installed version of JMagick is: JMagick-5.5.6
The installed version of ImageMagick is: ImageMagick-5.5.7-Q16

Here is the piece of code facing problem.

....
System.setProperty("jmagick.systemclassloader","no");

logger.debug("java.library.path=" + System.getProperty("java.library.path"));

String fileName = "file1.png";
ImageInfo info;
try {
info = new ImageInfo( fileName);
MagickImage image = new MagickImage( info);
} catch (MagickApiException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (MagickException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
....

The java.library.path contains "D:\Program Files\ImageMagick-5.5.7-Q16",, directory where I have copied JMagick.dll
The JMagick.jar is in the classpath.

I obtain the following error:

magick.MagickApiException: UnableToOpenFile
at magick.MagickImage.readImage(Native Method)
at magick.MagickImage.<init>(MagickImage.java:90)

The error occurs on the line : MagickImage image = new MagickImage( info);

Have you an idea of the solution ?

Thank you in advance,
Christian.