GraphicsMagick on MinGW

From ASCEND

Jump to: navigation, search
This page documents an experimental feature. You can help out by testing it and recording your experiences.

A very useful package for image processing is the ImageMagick/GraphicsMagick toolset. These projects are forks of a common codebase (see some discussion on this), with ImageMagick claiming the original title, but GraphicsMagick proving, in the current context at least, to contain a few more up-to-date bugfixes relating to MinGW. So this page relates to building GraphicsMagick on MinGW (Windows) and provides a downloadable installer that should be of use to people who don't want to bother doing the compile.

Feel free to correct/expand on this page. All contributions welcome.

Contents

[edit] Download

Download the installer: graphicsmagick-1.2.020071109.exe (2.9M installer)

The installer creates c:\Program Files\GraphicsMagick-xxx and subfolders bin, include, lib, etc. You can use the 'bin\gm.exe' file directly to perform image manipulation, or you can use the DLLs and include files to build your own image manipulation programs. See test code below for a minimal example.

Note: this installer INCLUDES copies of the prerequisite DLLs from the GnuWin32 packages. If you already have these on your PATH, you don't need to install them, so you can deselect 'GnuWin32 DLLs' at install time. Be warned however, that this may lead to problems if the DLLs are not exactly the same.

Note: this installer contains free open source software subject to a number of different licenses. Please check that the licenses of the various packages permit you to use the software in this bundled form.

[edit] Build it yourself

To build your own GraphicsMagick installer for Windows, you need to install a bunch of GnuWin32 packages including:

  • FreeType
  • Jpeg
  • Jbigkit
  • LibPng
  • LibWmf
  • Tiff
  • Zlib
  • Bzip2

I also had the following GnuWin32 libs installed, but I'm not sure that they're required: UnZip Xpm LibIconv LibIntl Wget.

You also should install Python (I used version 2.5) and SCons (I used version 0.97).

You also need MinGW and MSYS to be installed, and you will need the GCC compiler and other standard bits and pieces that come with MinGW. Try the Building ASCEND page for information on that, if you're not sure.

You need to download and untar the GraphicsMagick package (I used the 1.2.020071109 snapshot bz2 tarball) in your MSYS home directory.

Once you have all that stuff installed, you should be able to kick off the GraphicsMagick build. I have put the details of how to do that in the header of the SConstruct file enclosed in the above graphicsmagick-mingw-scripts.tar.bz2 tarball. But briefly, the commands used to build GraphicsMagick against the above GnuWin32 packages are as follows:

export CPPFLAGS="-Ic:/PROGRA~1/GnuWin32/include"
export LDFLAGS="-Lc:/PROGRA~1/GnuWin32/lib"
./configure --without-perl --enable-static=yes --enable-shared=yes \
   --prefix=/c/PROGRA~1/GraphicsMagick-1.2
make
make install DESTDIR=/home/john/temp_root

Once you have completed that build (it worked for me without errors) then you can bundle up the files but entering the graphicsmagic-mingw-scripts directory and typing 'scons'. You will need to have set your PATH:

export PATH=$PATH:/c/Python25:/c/Python25/scripts

This is required so that you can run SCons from MSYS.

At this point you will additionally need to make sure you have got NSIS installed, as it will be used to create the installer.

The result will be a file graphicsmagick-1.2.020071109.exe, which is the file I have uploaded above. My copy includes support for PNG, JPEG, BMP, WMF, TIFF and others.

The installer includes copies of the DLLs from GnuWin32 for supporting PNG, JPEG, etc. formats. You can elect not to install them if you already have them on your system PATH.

I'd appreciate any comments on the legality or otherwise of the above file, compliance with the GPL or other licenses, etc. If changes need to be made, please let me know. I'd like to add an appropriate license page to the installer, but I'm not sure what the requirements are at this stage.

[edit] Test Scripts

You can check that your GraphicsMagick package is working correctly by downloading the following package, unpacking it, and typing 'scons'. It should build and then you should be able to run the resulting .exe files without errors, providing you have all the necessary linking DLLs in your PATH.

[edit] TODO

  • check that installation coexists with Visual C++ stuff
  • rewrite the *-config scripts so that they work regardless of installed location
  • think about how different GraphicsMagick versions could coexist.
  • autogenerate python-based *-config scripts that translate MSYS paths into native Windows paths (or have '--msys' options?)
Personal tools