Installation problems in Windows 7

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
ssilk
Posts: 15
Joined: 2011-01-19T21:10:17-07:00
Authentication code: 8675308

Installation problems in Windows 7

Post by ssilk »

Hi all,

I just want to use Image Magick to load HDR images into a C++ project of mine.

I thought the easiest way to do this would be through the Windows Binary distributions, which include developer tools (header files, librarries, etc.). However, when I installed the latest version, I can compile the demo project but then they don't run. They all crash silently.

Then I thought I'd try building from source, so I got the distribution and followed the instruction here (http://www.imagemagick.org/script/advan ... lation.php) very carefully. After building the "All" project, I have many errors, mostly from other projects not being able to find core_rl_magick++_.lib; it seems like the project that's supposed to make that is failing. I've included two pertinent samples of the error output below and the entire output is available here (http://www.site.uottawa.ca/~ssilk083/im ... errors.txt) . I am running Windows 7 x64 and Visual Studio 2008. Any help would be greatly appreciated. Thanks.


12>------ Build started: Project: CORE_magick, Configuration: Release Win32 ------
11>player.c
12>Compiling...
11>meta.c
9>..\..\jp2\src\libjasper\jpc\jpc_t1enc.c(141) : warning C4018: '<' : signed/unsigned mismatch
12>xwindow.c
9>jpc_t1dec.c
12>MagickCore lib DLL import interface
12>MagickCore module DLL export interface
10>Compiling resources...
11>font.c
10>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
10>Copyright (C) Microsoft Corporation. All rights reserved.
10>Linking...
11>eps.c
10> Creating library ..\lib\CORE_RL_png_.lib and object ..\lib\CORE_RL_png_.exp
11>bbuf.c
10>Embedding manifest...
9>..\..\jp2\src\libjasper\jpc\jpc_t1dec.c(243) : warning C4013: 'jas_eprintf' undefined; assuming extern returning int
9>jpc_t1cod.c
11>Generating Code...
12>..\..\magick\xwindow.c(234) : error C2491: 'DestroyXResources' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(449) : error C2491: 'XAnnotateImage' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(772) : error C2491: 'XBestFont' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(880) : error C2491: 'XBestIconSize' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1008) : error C2491: 'XBestPixel' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1145) : error C2491: 'XBestVisualInfo' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1451) : error C2491: 'XCheckDefineCursor' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1486) : error C2491: 'XCheckRefreshWindows' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1546) : error C2491: 'XClientMessage' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1648) : error C2491: 'XComponentTerminus' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1684) : error C2491: 'XConfigureImageColormap' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1736) : error C2491: 'XConstrainWindowPosition' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1785) : error C2491: 'XDelay' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1815) : error C2491: 'XDestroyResourceInfo' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1857) : error C2491: 'XDestroyWindowColors' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(1936) : error C2491: 'XDisplayImageInfo' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(2271) : error C2491: 'XDrawImage' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(2649) : error C2491: 'XError' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(2726) : error C2491: 'XFreeResources' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(2816) : error C2491: 'XFreeStandardColormap' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(2868) : error C2491: 'XGetAnnotateInfo' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(2919) : error C2491: 'XGetMapInfo' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(2995) : error C2491: 'XGetPixelPacket' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(3245) : error C2491: 'XGetResourceClass' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(3334) : error C2491: 'XGetResourceDatabase' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(3438) : error C2491: 'XGetResourceInfo' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(3638) : error C2491: 'XGetResourceInstance' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(3690) : error C2491: 'XGetScreenDensity' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(3813) : error C2491: 'XGetWindowColor' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(4542) : error C2491: 'XGetWindowInfo' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(4691) : error C2491: 'XHighlightEllipse' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(4741) : error C2491: 'XHighlightLine' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(4785) : error C2491: 'XHighlightRectangle' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(4827) : error C2491: 'XImportImage' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(5100) : error C2491: 'XInitializeWindows' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(5297) : error C2491: 'XMakeCursor' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(5397) : error C2491: 'XMakeImage' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(7057) : error C2491: 'XMakeMagnifyImage' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(7679) : error C2491: 'XMakeStandardColormap' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(8293) : error C2491: 'XMakeWindow' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(8570) : error C2491: 'XMagickProgressMonitor' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(8611) : error C2491: 'XQueryColorDatabase' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(8690) : error C2491: 'XQueryPosition' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(8741) : error C2491: 'XRefreshWindow' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(8856) : error C2491: 'XRemoteCommand' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(8932) : error C2491: 'XRetainWindowColors' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(9172) : error C2491: 'XSetCursorState' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(9227) : error C2491: 'XSetWindows' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(9262) : error C2491: 'XUserPreferences' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(9390) : error C2491: 'XWarning' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(9437) : error C2491: 'XWindowByID' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(9515) : error C2491: 'XWindowByName' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(9592) : error C2491: 'XWindowByProperty' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(9701) : error C2491: 'XComponentGenesis' : definition of dllimport function not allowed
12>..\..\magick\xwindow.c(9728) : error C2491: 'XGetImportInfo' : definition of dllimport function not allowed
12>xml-tree.c
12>MagickCore lib DLL import interface
12>MagickCore module DLL export interface
10>Build log was saved at "file://c:\ImageMagick\ImageMagick-6.6.7\VisualMagick\Release\CORE_png\BuildLog.htm"


18>------ Build started: Project: IM_MOD_xps, Configuration: Release Win32 ------
15>Compiling...
18>Compiling...
15>wand.c
16>xwd.c
17>xtrn.c
18>xps.c
15>MagickWand lib DLL export interface
15>MagickWand module DLL export interface
17>MagickCore lib DLL import interface
17>MagickCore module DLL export interface
16>MagickCore lib DLL import interface
16>MagickCore module DLL export interface
18>MagickCore lib DLL import interface
18>MagickCore module DLL export interface
15>MagickWand lib DLL export interface
15>MagickWand module DLL export interface
15>Magick lib DLL export interface
15>Magick module DLL export interface
18>Linking...
15>wand-view.c
15>MagickWand lib DLL export interface
15>MagickWand module DLL export interface
18>LINK : fatal error LNK1181: cannot open input file '..\lib\core_rl_magick_.lib'
18>Build log was saved at "file://c:\ImageMagick\ImageMagick-6.6.7\VisualMagick\Release\IM_MOD_xps\BuildLog.htm"
18>IM_MOD_xps - 1 error(s), 0 warning(s)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Installation problems in Windows 7

Post by magick »

Undef MAGICKCORE_X11_DELEGATE in magick-config.h and rebuild.
ssilk
Posts: 15
Joined: 2011-01-19T21:10:17-07:00
Authentication code: 8675308

Re: Installation problems in Windows 7

Post by ssilk »

That seems to have done the job for the most part. However, I'm still having trouble with HDR images. The following is a simple image copying program I made, and it works fine with JPEGs, but with .hdr or .exr images, it still builds fine, but when I run it I get a terminal message that "his application has requested the Runtime to terminate it in an unusual way".

Code: Select all

#include<Magick++.h>
#include<string.h>
using namespace Magick;
using namespace std;

int main(){

	Image my_image; 
	my_image.read("Indoor.exr");
	my_image.write("copy.exr");

	return 0;
}
In the configure utility, I did #define MAGICKCORE_HDRI_SUPPORT, and when I run identify -version, I get:

Version: ImageMagick 6.6.7-1 2011-01-07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: HDRI

Is there anything else I need to do to get this working? Thanks.
ssilk
Posts: 15
Joined: 2011-01-19T21:10:17-07:00
Authentication code: 8675308

Re: Installation problems in Windows 7

Post by ssilk »

OK, I got this working. You can download the Windows distribution (Visual Studio 2005) of OpenEXR from the OpenEXR website, extract it to a folder called "exr" in the main Image Magick folder (not the Visual Magick folder). Then run the configure utility, edit magick-config.h, add the following:

#define MAGICKCORE_HDRI_SUPPORT
#define MAGICKCORE_OPENEXR_DELEGATE

I'm not clear which of those are actually needed to get EXR support working, but I've seen them both mentioned in other posts on this forum, so I used them both. After running Image Magick, open the SLN file it produces (e.g. VisualDynamicMT). Find the project IM_MOD_exr, and open its linker properties. Add the following:
Half.lib
Iex.lib
IlmImf.lib
IlmThread.lib
Imath.lib
zlib.lib

Then, build Image Magick the normal way. If you get errors from IM_MOD_exr, you might need to add the path to \exr\openexr-1.4.0-vs2005\openexr-1.4.0-vs2005\lib to your VS library paths. Once you've built without errors, run a few simple tests to see if it's handling EXRs ok:

1. Go to the folder \VisualMagick\bin\, open a command prompt, and run "identify -list format" without quotes. Look through the list of formats for EXR. If it's there, it should have rw- next to it (rw+ might be ok too). If EXR is not listed, or has --- next to it, that apparently means Image Magick is not set up for it yet. Try steps 2 and 3 anyway.

2. Regardless of the results of 1, you may want to try the following as well. Open IMdisplay.exe from the bin folder. Drag & drop an EXR into it. If it loads with no complaints, that's a good sign; it will look crazy (mine looked like total static), but that doesn't mean it's not working.

3. Finally, try reading then writing an EXR by building a small project with the following code, bearing in mind the usual includes and links required. All it does is loads an EXR then saves a copy.

Code: Select all

#include<Magick++.h>
#include<string.h>
using namespace Magick;
using namespace std;

int main(){

	Image my_image; 
	my_image.read("test.exr");
	my_image.write("copy.exr");

	return 0;
}
If that builds and runs ok, open "copy.exr" in an EXR viewer, I recommend Photomatix which has a fully functional free trial with a good HDR viewer. Verify that the copy looks the same as the original.

That's all I've done so far, but it looks promising. Now trying to get HDR support (i.e. .hdr image support) working; any tips would be greatly appreciated.
Last edited by ssilk on 2011-01-21T13:20:40-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Installation problems in Windows 7

Post by magick »

Now trying to get HDR support (i.e. .hdr image support) working; any tips would be greatly appreciated.
ImageMagick uses the ra_pfm external delegate program to read HDR image files. We have not tested it under Windows. If you get it working, let us know and we'll post a delegates.xml configuration file that adds support for HDR under Windows.
ssilk
Posts: 15
Joined: 2011-01-19T21:10:17-07:00
Authentication code: 8675308

Re: Installation problems in Windows 7

Post by ssilk »

HI, thanks for the response. I've seen this explanation a few times, but I haven't seen any explanation of what a delegate program means. I downloaded a precompiled version of Radiance and it has a copy of ra_ppm.exe. Do I just need to copy this into the Image Magick folder somewhere? If so, can you clarify where? I put a copy in the VisualMagick/bin folder, and that allowed me to load an hdr image and save a copy as an exr, but not as an hdr. Also, when I open the exr copy, it's just a grey image.

I.e.g, the following code crashes, but a file "copy.exr" is created and is about 6MB, but it's grey. No file "copy.hdr" is created.

Code: Select all

	Image my_image; 
	my_image.read("result.hdr");
	my_image.write("copy.exr");
	my_image.write("copy.hdr");
Any further help or links to clarify what is meant by "delegate library" would be greatly appreciated. Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Installation problems in Windows 7

Post by fmw42 »

Basically a delegate library is some external code to support image formats such as tif, png, jpg etc that IM relies upon to do the heavy work. Once installs the delegate library according its instructions and then recompiles IM. At least that is how it works in Linux/Mac IM. Most delegates are preinstalled, I believe, in Windows and Unix binaries. But if you install IM from scratch, you have to install the delegates manually, at least with Linux/Mac. I am not a windows user, so cannot help with regard to installing any delegates there.

see linux/mac delegates list at http://www.imagemagick.org/download/delegates/, but this is not a complete or possible current set.

You will likely need more help from a Windows IM user/expert.
Post Reply