Page 1 of 1

Unable to Display Image

Posted: 2011-07-11T15:23:04-07:00
by regneva
I'm compiling Image Magic as a DLL's in an MFC Visual Studio 2008 project on Windows 7, for a Windows based application.

I can create an image, 'InitializeMagick' (at least no exception or errors are thrown, and the variable is set to true), then read the existing image (at least no exception or errors are thrown), but when I try to display it, I get an unhandled exception. Although, if I trace the code, it is trying to throw an exception, "UnableToOpenXServer".

I believe the root of the issue is the X Server. When I configured the project, I selected 'Use X11 stubs to prevent use of X Window'. As I'm looking around the documentation and this forum, I'm afraid I'm still not understanding what is that I need to do with the X Server.

I read somewhere that I need to install and have an X Server running. I read elsewhere that I need to set the DISPLAY environment variable to ':0'
or 'localhost:0.0', but I only saw how to do that in a command-line environment, not in the DLLs. Is it possible to run display in ImageMagic in the dll or libs, without installing an x server? I do have ImageMagic installed and it runs fine without an extra X Server installed.

Thank you in advance,
--Eric

Re: Unable to Display Image

Posted: 2011-07-13T13:51:39-07:00
by regneva
To anyone else having similar problems, here's my resolution; I never did determine whether it was necessary to X Server to run the Display Function, but I believe it is, because it would need access to some sort of GUI and with Image Magick being cross-platform, isn't likely to have one in the lib/dlls.
However, I did find an example that shows how to display an image using MFC (a GUI in VS 2008). You need to compile all the demos and tests, and then look under the project: "UTIL_NTMagick". You can right Click and set it as the startup (or default) project and debug an example using Image Magick in MFC. You can look in NtMagickView.h for the code. Basically it gives an example of setting up the canvas window in MFC, but using Image Magick for the Image work. I have not yet implemented this in our project, but I believe that I'll be able to in the coming days.