]> granicus.if.org Git - imagemagick/blob - www/advanced-windows-installation.html
Merge branch 'master' of git.imagemagick.org:repos/ImageMagick
[imagemagick] / www / advanced-windows-installation.html
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4   
5     <title>ImageMagick: Advanced Windows Source Installation</title>
6   <meta http-equiv="content-type" content="text/html; charset=utf-8">
7   <meta name="application-name" content="ImageMagick">
8   <meta name="description" content="ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.">
9   <meta name="application-url" content="http://www.imagemagick.org">
10   <meta name="generator" content="PHP">
11   <meta name="keywords" content="advanced, windows, source, installation, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert">
12   <meta name="rating" content="GENERAL">
13   <meta name="robots" content="INDEX, FOLLOW">
14   <meta name="generator" content="ImageMagick Studio LLC">
15   <meta name="author" content="ImageMagick Studio LLC">
16   <meta name="revisit-after" content="2 DAYS">
17   <meta name="resource-type" content="document">
18   <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC">
19   <meta name="distribution" content="Global">
20   <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
21   <link rel="icon" href="../images/wand.png">
22   <link rel="shortcut icon" href="../images/wand.ico">
23   <link rel="stylesheet" href="../css/magick.html">
24 </head>
25 <body>
26 <div class="main">
27 <div class="magick-masthead">
28   <div class="container">
29     <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3129977114552745" data-ad-slot="6345125851" data-ad-format="auto"></ins>
30     <script>
31       (adsbygoogle = window.adsbygoogle || []).push({});
32     </script>
33     <nav class="magick-nav">
34       <a class="magick-nav-item " href="../index.html">Home</a>
35       <a class="magick-nav-item " href="binary-releases.html">Download</a>
36       <a class="magick-nav-item " href="command-line-tools.html">Tools</a>
37       <a class="magick-nav-item " href="command-line-options.html">Options</a>
38       <a class="magick-nav-item " href="resources.html">Resources</a>
39       <a class="magick-nav-item " href="api.html">Develop</a>
40       <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
41       <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
42     </nav>
43   </div>
44 </div>
45 <div class="container">
46 <div class="magick-header">
47 <p class="text-center"><a href="advanced-windows-installation.html#download">Download &amp; Unpack</a> • <a href="advanced-windows-installation.html#configure">Configure</a>  • <a href="advanced-windows-installation.html#build">Build</a> • <a href="advanced-windows-installation.html#install">Install</a> • <a href="advanced-windows-installation.html#binary">Create a Self-installing Binary Distribution</a> • <a href="advanced-windows-installation.html#problems">Dealing with Unexpected Problems</a> • <a href="advanced-windows-installation.html#project">Building Your Custom Project</a></p>
48
49 <p class="lead magick-description">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 <a href="binary-releases.html#windows">binary release</a> or if you still want to install from source without all the fuss see the simple <a href="install-source.html#windows">Install From Source</a> instructions.  However, if you want to customize the configuration and installation of ImageMagick under Windows, lets begin.</p>
50
51 <h2 class="magick-header"><a id="download"></a>Download &amp; Unpack</h2>
52
53 <p>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 <a href="binary-releases.html#windows">binary release</a>.</p>
54
55 <p>Download <a href="http://www.imagemagick.org/download/windows/ImageMagick-windows.zip">ImageMagick-windows.zip</a> from <a href="http://www.imagemagick.org/download/windows">ftp.imagemagick.org</a> or its <a href="download.html">mirrors</a> and verify the distribution against its <a href="http://www.imagemagick.org/download/windows/digest.rdf">message digest</a>.</p>
56
57 <p>You can unpack the distribution with <a href="http://www.winzip.com">WinZip</a> or type the following from any Command Prompt window:</p>
58
59 <pre>
60 unzip ImageMagick-windows.zip
61 </pre>
62
63 <p>Now that you have the ImageMagick Windows source distribution unpacked, let's configure it.</p>
64
65
66 <h2 class="magick-header"><a id="configure"></a>Configure</h2>
67
68 <p>These instructions are specific to building ImageMagick with the <a href="http://msdn.microsoft.com/vstudio/">Visual Studio</a> 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 <code>configure</code> program that must be built and run which creates the Visual Studio workspaces for ImageMagick.  The Visual Studio system provides four different types of <var>runtime</var> environments that must match across all application, library, and dynamic-library (DLL) code that is built. The <code>configure</code> program creates a set of build files that are consistent for a specific runtime selection listed here:</p>
69
70 <ol>
71   <li>Dynamic Multi-threaded DLL runtimes (VisualDynamicMT).</li>
72   <li>Static Single-threaded runtimes (VisualStaticST).</li>
73         <li>Static Multi-threaded runtimes (VisualStaticMT).</li>
74         <li>Static Multi-threaded DLL runtimes (VisualStaticMTDLL).</li>
75 </ol>
76
77 <p>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 <code>animate</code>, <code>display</code>, and <code>import</code> program depends on the X11 delegate libraries, these programs will no work if you choose not to include X11 support.</p>
78
79 <p>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).</p>
80
81 <p>To create a workspace for your requirements, simply go to the <code>VisualMagick\configure</code> folder and open the <code>configure.dsw</code> workspace (for Visual Studio 6) or <code>configure.sln</code> (for Visual Studio 7 or 8). Set the build configuration to <var>Release</var>.</p>
82
83 <p>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.</p>
84
85 <p>The configure program has a button entitled:</p>
86
87 <p>
88   Edit "magick_config.h"
89 </p>
90
91 <p>Click on this button to bring up <code>magick-config.h</code> in Windows Notepad.  Review and optionally change any preprocessor defines in ImageMagick's <code>magick_config.h</code> file to suit your needs.  This file is copied to <code>magick\magick_config.h</code>.  You may safely open <code>magick\magick_config.h</code>, 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 <code>magick_config.h</code> file.</p>
92
93 <p>Key user defines in <code>magick_config.h</code> include:</p>
94
95 <div class="table-responsive">
96 <table class="table table-condensed table-striped">
97   <tr>
98     <td>MAGICKCORE_QUANTUM_DEPTH (default 16)</td>
99     <td>Specify the depth of the pixel component depth (8, 16, or 32).  A value of 8 uses half the memory than 16 and may run 30% faster, but provides 256 times less color resolution than a value of 16.  We recommend a quantum depth of 16 because 16-bit images are becoming more prevalent on the Internet.</td>
100   </tr>
101   <tr>
102     <td>MAGICKCORE_INSTALLED_SUPPORT (default undefined)</td>
103     <td>Define to build a ImageMagick which uses registry settings or embedded paths to locate installed components (coder modules and configuration files). The default is to look for all files in the same directory as the executable.  You will wand to define this value if you intend on <a href="advanced-windows-installation.html#install">installing</a> ImageMagick on your system.</td>
104   </tr>
105   <tr>
106     <td>ProvideDllMain (default defined)</td>
107     <td>Define to include a DllMain() function ensures that the ImageMagick DLL is properly initialized without participation from dependent applications. This avoids the requirement to invoke InitializeMagick() from dependent applications is only useful for DLL builds.</td>
108   </tr>
109 </table></div>
110
111 <p>ImageMagick is now configured and ready to build.</p>
112
113 <p>The default build is WIN32.  For 64-bit, open a newly created solution and enter Configuration Manager. Add a x64 configuration, copying the configuration from Win32. Be sure  that it adds the configuration to all the projects.  Now compile.  For the 64-bit build, you will also need to disable X11 support.  Edit magick-config.h and undefine the MAGICKCORE_X11_DELEGATE define.</p>
114
115 <h2 class="magick-header"><a id="Build"></a>Build</h2>
116
117 <p>After creating your build environment, proceed to open the DSW (or SLN) workspace in the <code>VisualMagick</code> folder.  In the DSW file choose the <var>All</var> project to make it the <var>active</var> project.  Set the build configuration to the desired one (Debug, or Release) and <var>clean</var> and <var>build:</var></p>
118
119 <ol>
120   <li>Right click on the All project and select <var>Set As Active Project</var></li>
121   <li>Select "Build=&gt;Clean Solution"</li>
122         <li>Select "Build=&gt;Build Solution"</li>
123 </ol>
124
125 <p>The <var>clean</var> 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.</p>
126
127 <p>After a successful build, all of the required files that are needed to run any of the <a href="command-line-tools.html">command line tools</a> are located in the <code>VisualMagick\bin</code> 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.</p>
128
129 <p>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 <code>ImageMagick\Magick++\demo</code>, and <code>ImageMagick\Magick++\tests</code>. There are also a variety of tests that use the straight C API as well in ImageMagick\tests.</p>
130
131 <p> All of these programs are <var>not</var> 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:</p>
132
133 <p>
134   Include all demo and test programs
135 </p>
136
137 <p>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.</p>
138
139 <p>This the checkbox:</p>
140
141 <p>
142   Generate all utility projects with full paths rather then relative paths.
143 </p>
144
145 <p>Visual Studio uses a concept of <var>dependencies</var> 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.</p>
146
147 <p>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.</p>
148
149 <p>With this feature enabled, you should be able to nab a copy of</p>
150
151 <pre>
152 VisualMagick\utilities\UTIL_convert_xxx_exe.dsp  (for C) or
153 VisualMagick\Magick++\demo\UTIL_demo_xxx_exe.dsp (for C++)
154 </pre>
155
156 <p>and pop it into Notepad, modify it (carefully) to your needs and be on your way to happy compiling and linking.</p>
157
158 <p> 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.</p>
159
160 <p>The choice of what to use as a starting point is very easy.</p>
161
162 <p>For straight C API command line applications use something from:</p>
163
164 <pre>
165 ImageMagick\tests or
166 ImageMagick\utilities (source code) or
167 ImageMagick\VisualMagick\tests or
168 ImageMagick\Visualmagick\utilities (project - DSP)
169 </pre>
170
171 <p>For C++ and Magick++ command line applications use something from:</p>
172
173 <pre>
174 ImageMagick\Magick++\tests or ImageMagick\Magick++\demo (source code) or
175 ImageMagick\VisualMagick\Magick++\tests or  <br>
176 ImageMagick\VisualMagick\Magick++\demo (project - DSP)
177 </pre>
178
179 <p>For C++ and Magick++ and MFC windows applications use:</p>
180
181 <pre>
182 ImageMagick\contrib\win32\MFC\NtMagick (source code) or
183 ImageMagick\VisualMagick\contrib\win32\MFC\NtMagick (project - DSP)
184 </pre>
185
186 <p>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.</p>
187
188 <p>The default options are all targeted at having all the components in one place (e.g. the <code>bin</code> directory of the VisualMagick build tree). These components may be copied to another folder (such as to another computer).</p>
189
190 <p>The folder containing the executables and DLLs should contain the following files:</p>
191
192 <ol>
193   <li>magic.xml</li>
194   <li>delegates.xml</li>
195   <li>modules.xml</li>
196   <li>colors.xml</li>
197 </ol>
198
199 <p>among others.</p>
200
201 <p>The <code>bin</code> folder should contains all EXE's and DLL's as well as the very important <code>modules.xml</code> file.</p>
202
203 <p>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 <code>pushd e:\xxx\yyy\bin</code> in any scripts you write to execute <var>out of</var> this directory.</p>
204
205 <p>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.</p>
206
207         <h3>ENVIRONMENT VARIABLES</h3>
208
209                 <p>You can use the <var>System</var> 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.</p>
210
211                 <h4>PATH</h4>
212                   <p>This environmental variable sets the default list of places were Windows looks for EXE's and DLL's. Windows CMD shell seems to look in the <var>current</var> directory first no matter what, which may make it unnecessary to update the PATH. If you wish to run any of utilities from another location then you must add the path to your <code>bin</code> directory in. For instance, to do this for the default build environment like I do, you might add:</p>
213
214
215 <pre>
216 C:\ImageMagick\VisualMagick\bin
217 </pre>
218
219                 <h4>MAGICK_HOME</h4>
220                   <p>If all you do is modify the PATH variable, the first problem you will run into is that ImageMagick may not be able to find any of its <var>modules</var>. Modules are all the IM_MOD*.DLL files you see in the distribution. There is one of these for each and every file format that ImageMagick supports. This environment variable tells the system were to look for these DLL's. The compiled in <var>default</var> is <var>execution path</var> - which says - look in the same place that the application is running <var>in</var>. If you are running from somewhere other then <code>bin</code> - this will no longer work and you must use this variable. If you elect to leave the modules in the same place as the EXE's (a good idea) then you can simply set this to the same place as you did the PATH variable. In my case:</p>
221
222 <pre>
223 C:\ImageMagick\coders
224 </pre>
225
226                         <p>This also the place were ImageMagick expects to find the <code>colors.xml</code>, <code>delegates.xml</code>, <code>magic.xml</code>, <code>modules.xml</code>, and <code>type.xml</code> files.</p>
227
228 <p>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.</p>
229
230 <p>Always keep the XC format, since ImageMagick uses it internally.</p>
231
232 <p>You can elect to changes these things the good old <var>hard-coded</var> way. This define is applicable in <code>magick-config.h</code>:</p>
233
234 <pre>
235 #define MagickConfigurePath  "C:\\ImageMagick\\"
236 </pre>
237
238 <p>To view any image in a Microsoft window, type</p>
239
240 <pre>
241 convert image.ext win:
242 </pre>
243
244 <p>Make sure <a href="http://www.cs.wisc.edu/~ghost/">Ghostscript</a> is installed, otherwise, you will be unable to convert or view a Postscript document, and Postscript standard fonts will not be available.</p>
245
246 <p>You may use any standard web browser (e.g. Internet Explorer) to browse the ImageMagick documentation.</p>
247
248 <p>The Win2K executables will work under Windows 98.</p>
249
250 <p>ImageMagick is now configured and built. You can optionally install it on your system as discussed below.</p>
251
252 <p>If you are looking to install the ImageMagick COM+ object, see <a href="ImageMagickObject.html">Installing the ImageMagickObject COM+ Component</a>.</p>
253
254 <h2 class="magick-header"><a id="Install"></a>Install</h2>
255
256 <p>You can run ImageMagick command line utilities directly from the <code>VisualMagick\bin</code> folder, however, in most cases you may want the convenience of an installer script.  ImageMagick provides <a href="http://www.jrsoftware.org">Inno Setup</a> scripts for this purpose.  Note, you must define MAGICKCORE_INSTALLED_SUPPORT at <a href="advanced-windows-installation.html#configure">configure</a> time to utilize the installer scripts.</p>
257
258 <p>To get started building a self-installing ImageMagick executable, go to <code>VisualMagick\installer</code> folder and click on a script that matches your build environment.  Press F9 to build and install ImageMagick.  The default location is <code>C:Program Files\ImageMagick-6.?.?\Q?</code>.  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.</p>
259
260
261 <h2 class="magick-header"><a id="binary"></a>Create a Self-Installing Binary Distribution</h2>
262
263 <h3>Prerequisites</h3>
264
265         <ol>
266         <li>Download and install <a href="http://www.jrsoftware.org/isdl.html">Inno Setup 5</a>.</li>
267         <li>Download and install <a href="http://strawberryperl.com/">Strawberry Perl</a>.</li>
268         </ol>
269
270 <h3>Run the Configure Wizard</h3>
271
272         <ol>
273         <li>Double-click on <code>VisualMagick/configure/configure.sln</code> to build the configure wizard.</li>
274         <li>Select <code>Rebuild All</code> and launch the configure wizard.</li>
275         <li>Uncheck <code>Use X11 Stubs</code> and check <code>Build demo and test programs</code>.</li>
276         <li>Click on <code>Edit magick_config.h</code> and define <code>MAGICKCORE_INSTALLED_SUPPORT</code>.</li>
277         <li>Complete the configure wizard screens to create the ImageMagick Visual C++ workspace.</li>
278         </ol>
279
280 <h3>Build ImageMagick</h3>
281
282         <ol>
283         <li>Double-click on <code>VisualMagick/VisualDynamicMT.sln</code> to launch the ImageMagick Visual workspace.</li>
284         <li>Set the active configuration to <code>Win32 Release</code>.</li>
285         <li>Select <code>Rebuild All</code> to build the ImageMagick binary distribution.</li>
286         </ol>
287
288 <h3>Build ImageMagickObject</h3>
289
290         <ol>
291         <li>Launch the Command Prompt application and move to the <code>contrib\win32\ATL7\ImageMagickObject</code> folder.</li>
292         <li>Build ImageMagickObject with these commands:
293 <pre>
294 BuildImageMagickObject clean
295 BuildImageMagickObject release
296 </pre></li>
297         </ol>
298
299 <h3>Build PerlMagick</h3>
300
301         <ol>
302         <li>Launch the Command Prompt application and move to the <code>PerlMagick</code> folder.</li>
303         <li>Build PerlMagick with these commands:
304 <pre>
305 perl Makefile.PL
306 dmake release
307 </pre></li>
308         </ol>
309
310 <h3>Create the Self-installing ImageMagick Binary Distribution</h3>
311
312         <ol>
313         <li>Double-click on <code>VisualMagick/installer/im-dll-16.iss</code> to launch the Inno Setup 5 wizard.</li>
314         <li>Select <code>File-&gt;Compile</code>.</li>
315         </ol>
316
317 <h3>Install the Binary Distribution</h3>
318
319         <ol>
320         <li>Double-click on
321         <code>VisualMagick/bin/ImageMagick-7.0.0-0-Q16-windows-dll.exe</code>
322         to launch the ImageMagick binary distribution.</li>
323         <li>Complete the installer screens to install ImageMagick on your system.</li>
324         </ol>
325
326 <h3>Test the Binary Distribution</h3>
327
328         <ol>
329         <li>Launch the Command Prompt application and move to the <code>PerlMagick</code> folder and type
330 <pre>
331 nmake test
332 </pre></li>
333
334         <li>Move to the <code>VisualMagick/tests</code> folder and type
335 <pre>
336 validate
337 </pre></li>
338         <li>Move to the <code>VisualMagick/Magick++/tests</code> folder and type
339 <pre>
340 run_tests.bat
341 </pre></li>
342         <li>Move to the <code>VisualMagick/Magick++/demo</code> folder and type
343 <pre>
344 run_demos.bat
345 </pre></li>
346         </ol>
347
348 <p>If all the tests pass without complaint, the ImageMagick self-install binary distribution is ready for use.</p>
349
350 <h2 class="magick-header"><a id="problems"></a>Dealing with Unexpected Problems</h2>
351
352 <p>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.</p>
353
354 <p>If the compiler generates an error or if it quits unexpectedly, go to the <a href="http://msdn.microsoft.com/vstudio/">Visual Studio</a> 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.</p>
355
356
357 <h2 class="magick-header"><a id="project"></a>Building Your Custom Project</h2>
358
359 <p>The Windows <a href="binary-releases.html#windows">binary</a> distribution includes a number of demo projects that you can use as a template for your own custom project.  For example, start with the Button project, generally located in the <code>c:/Program Files/ImageMagick-6.5.5-0/Magick++_demos</code> folder.  If not, be sure to select <code>Configuration Properties-&gt;C/C++-&gt;Preprocessor</code> and set these definitions:</p>
360
361 <pre>
362 NDEBUG
363 WIN32
364 _CONSOLE
365 _VISUALC_
366 NeedFunctionPrototypes
367 _DLL
368 _MAGICKMOD_
369 </pre>
370
371 </div>
372   <footer class="magick-footer">
373     <p><a href="support.html">Donate</a> •
374      <a href="sitemap.html">Sitemap</a> •
375     <a href="links.html">Related</a> •
376     <a href="architecture.html">Architecture</a>
377 </p>
378     <p><a href="advanced-windows-installation.html#">Back to top</a> •
379     <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
380     <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
381         <p><small>©  1999-2015 ImageMagick Studio LLC</small></p>
382   </footer>
383 </div><!-- /.container -->
384
385   <script src="https://localhost/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
386   <script src="http://nextgen.imagemagick.org/js/magick.html"></script>
387 </div>
388 </body>
389 </html>