JMagick simple image reading

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
charan

JMagick simple image reading

Post 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.
Post Reply