[
About ImageMagick
Command-line Tools
Program Interfaces
] [ Install from Source Binary Releases Resources ] [ Download ] [ Links ] [ Sponsors Larscapes ] |
It's possible you don't want to concern yourself with advanced installation under Windows. If so, you also have the option of installing a self-installing binary release or if you still want to install from source without all the fuss see the simple Install From Source instructions. However, if you want to customize the configuration and installation of ImageMagick under Windows, lets begin. Building ImageMagick source for Windows requires a modern version of Microsoft Visual Studio IDE. Users have reported success with the Borland C++ compiler as well. If you don't have a compiler you can still install a self-installing binary release.
Download ImageMagick-windows.zip from ftp.imagemagick.org or its mirrors. You can unpack the distribution with WinZip or type the following from any MS-DOS Command Prompt window:
unzip ImageMagick-windows.zip Now that you have the ImageMagick Windows source distribution unpacked, let's configure it. These instructions are specific to building ImageMagick with the Visual Studio under Windows XP, Win2K, or Windows 98. ImageMagick does not include any workspace (DSW) or project files (DSP) except for those included with third party libraries. Instead, there is a configure program that must be built and run which creates the Visual Studio workspaces for ImageMagick. The Visual Studio system provides four different types of runtime environments that must match across all application, library, and dynamic-library (DLL) code that is built. The configure program creates a set of build files that are consistent for a specific runtime selection listed here:
In addition to these runtimes, the VisualMagick build environment allows you to select whether to include the X11 libraries in the build or not. X11 DLLs and headers are provided with the VisualMagick build environment. Most Windows users are probably not interested in using X11, so you might prefer to build without X11 support. Since the animate, display, and import program depends on the X11 delegate libraries, these programs will no work if you choose not to include X11 support. This leads to five different possible build options. The default binary distribution is built using the Dynamic Multi-threaded DLL (VisualDynamicMT) option with the X11 libraries included. This results in an X11 compatible build using all DLL's for everything and multi-threaded support (the only option for DLL's). To create a workspace for your requirements, simply go to the VisualMagick\configure folder and open the configure.dsw workspace (for Visual Studio 6.0) or configure.sln (for Visual Studio 7.0). Set the build configuration to Release. Build and execute the configure program and follow the on-screen instructions. You should not change any of the defaults unless you have a specific reason to do so. The configure program has a button entitled: Edit "magick_config.h" Click on this button to bring up magick-config.h in Windows Notepad. Review and optionally change any preprocessor defines in ImageMagick's magick_config.h file to suit your needs. This file is copied to magick\magick_config.h. You may safely open magick\magick_config.h, modify it, and recompile without re-running the configure program. In fact, using Notepad to edit the copied file may be preferable since it preserves the original magick_config.h file. Key user defines in magick_config.h include:
ImageMagick is now configured and ready to build. After creating your build environment, proceed to open the DSW (or SLN) workspace in the VisualMagick folder. In the DSW file choose the All project to make it the active project. Set the build configuration to the desired one (Debug, or Release) and clean and build:
The clean step is necessary in order to make sure that all of the target support libraries are updated with any patches needed to get them to compile properly under Visual Studio. After a successful build, all of the required files that are needed to run any of the command line tools are located in the VisualMagick\bin folder. This includes EXE, DLL libraries, and ImageMagick configuration files. You should be able to test the build directly from this directory without having to move anything to any of the global SYSTEM or SYSTEM32 areas in the operating system installation. The Visual Studio distribution of ImageMagick comes with the Magick++ C++ wrapper by default. This add-on layer has a large number of demo and test files that can be found in ImageMagick\Magick++\demo, and ImageMagick\Magick++\tests. There are also a variety of tests that use the straight C API as well in ImageMagick\tests. All of these programs are not configured to be built in the default workspace created by the configure program. You can cause all of these demos and test programs to be built by checking the box in configure that says: Include all demo and test programs In addition, there is another related checkbox (checked by default) that causes all generated project files to be created standalone so that they can be copied to other areas of you system. This is the checkbox: Generate all utility projects with full paths rather then relative paths. Visual Studio uses a concept of dependencies that tell it what other components need to be build when a particular project is being build. This mechanism is also used to ensure that components link properly. In my normal development environment, I want to be able to make changes and debug the system as a whole, so I like and NEED to use dependencies. However, most end users don't want to work this way. Instead they really just want to build the package and then get down to business working on their application. The solution is to make all the utility projects (UTIL_xxxx_yy_exe.dsp) use full absolute paths to all the things they need. This way the projects stand on their own and can actually be copied and used as templates to get a particular custom application compiling with little effort. With this feature enabled, you should be able to nab a copy of VisualMagick\utilities\UTIL_convert_xxx_exe.dsp (for C) or VisualMagick\Magick++\demo\UTIL_demo_xxx_exe.dsp (for C++) and pop it into Notepad, modify it (carefully) to your needs and be on your way to happy compiling and linking. You can feel free to pick any of the standard utilities, tests, or demo programs as the basis for a new program by copying the project and the source and hacking away. The choice of what to use as a starting point is very easy. For straight C API command line applications use something from: ImageMagick\tests or ImageMagick\utilities (source code) or ImageMagick\VisualMagick\tests or ImageMagick\Visualmagick\utilities (project - DSP) For C++ and Magick++ command line applications use something from: ImageMagick\Magick++\tests or ImageMagick\Magick++\demo (source code) or ImageMagick\VisualMagick\Magick++\tests or ImageMagick\VisualMagick\Magick++\demo (project - DSP) For C++ and Magick++ and MFC windows applications use: ImageMagick\contrib\win32\MFC\NtMagick (source code) or ImageMagick\VisualMagick\contrib\win32\MFC\NtMagick (project - DSP) The ImageMagick distribution is very modular. The default configuration is there to get you rolling, but you need to make some serious choices when you wish to change things around. The default options are all targeted at having all the components in one place (e.g. the bin directory of the VisualMagick build tree). These components may be copied to another folder (such as to another computer). The folder containing the executables and DLLs should contain the following files:
among others. The bin folder should contains all EXE's and DLL's as well as the very important modules.xml file. With this default setup, you can use any of the command line tools and run scripts as normal. You can actually get by quite nicely this way by doing something like pushd e:\xxx\yyy\bin in any scripts you write to execute out of this directory. By default the core of ImageMagick on Win32 always looks in the place were the exe program is run from in order to find all of the files as well as the DLL's it needs. ENVIRONMENT VARIABLES You can use the System control panel to allow you to add and delete what is in any of the environment variables. You can even have user specific environment variables if you wish.
D:\CVS\ImageMagick\VisualMagick\bin D:\\ImageMagick\coders One cool thing about the modules build of ImageMagick is that you can now leave out file formats and lighten you load. If all you ever need is GIF and JPEG, then simply drop all the other DLL's into the local trash can and get on with your life. Always keep the XC format, since ImageMagick uses it internally. You can elect to changes these things the good old hard-coded way. This define is applicable in magick-config.h: #define MagickConfigurePath "c:\\ImageMagick\\" To view any image in a Microsoft window, type convert image.ext win: Make sure Ghostscript is installed, otherwise, you will be unable to convert or view a Postscript document, and Postscript standard fonts will not be available. You may use any standard web browser (e.g. Internet Explorer) to browse the ImageMagick documentation. The Win2K executables will work under Windows 98. ImageMagick is now configured and built. You can optionally install it on your system as discussed below. You can run ImageMagick command line utilities directly from the VisualMagick\bin folder, however, in most cases you may want the convenience of an installer script. ImageMagick provides Inno Setup scripts for this purpose. Note, you must define UseInstalledMagick at configure time to utilize the installer scripts. To get started building a self-installing ImageMagick executable, go to VisualMagick\installer folder and click on a script that matches your build environment. Press F9 to build and install ImageMagick. The default location is C:Program Files\ImageMagick-6.?.?\Q?. The exact folder name depends on the ImageMagick version and quantum depth. Once installed, ImageMagick command line utilities and libraries are available to the MS Command Prompt, web scripts, or to meet your development needs. Chances are the download, configure, build, and install of ImageMagick went flawlessly as it is intended, however, certain systems and environments may cause one or more steps to fail. We discuss a few problems we've run across and how to take corrective action to ensure you have a working release of ImageMagick If the compiler generates an error or if it quits unexpectedly, go to the Visual Studio web site and look for Visual Studio service packs. Chances are, after you download and install all the Visual Studio service packs, ImageMagick will compile and build as expected. |