Building GIMP for Windows

The main GIMP building instructions are at Building GIMP . This page is for Windows-specific additions.

Supported Windows API

The supported versions of Windows are noted in the devel-docs/os-support.txt file in the respective branches:

GIMP project is favoring backward compatibility as a general rule and we really don’t like deprecating hardware (unfortunately often associated to OS version, sometimes for no good reasons, sometimes on purpose by vendors) when it is just a few years old. Nevertheless we may have to bump our Windows requirement when it becomes too hard to maintain both old and new APIs.

Copying our Continuous Integration scripts

Since our CI for the development branch include Windows builds, and that we try to keep this build as full-featured and up-to-date as possible (because it is here to warn us of any new issue), a good practice could be to look at the .gitlab-ci.yml file in our repository.

We have 2 pipelines for Windows:

  • For cross-compilation on Debian Testing for Windows, you should look at the build-image-win64 job for dependencies to install on Debian from its package manager, at deps-win64 for the dependencies we build ourselves with crossroad and at gimp-win64 for compilation of GIMP with crossroad.
  • For native MSYS2 compilation, you should look at deps-win64-native for the dependencies to install with pacman and at gimp-win64-native for compilation of GIMP.

Copying the commands run by these jobs might be all there is to do for you. To better understand the compilation flow, you may read below.

Building GIMP natively under Windows using MSYS2

MSYS2 is a POSIX environment with basically everything you would find on a Linux system (shell, package manager, GCC…). It allows to use POSIX tools to build Windows software.

Setting up the environment

  1. First, follow the installation instructions for msys2 available at msys2.github.io .
  2. To open a terminal, you need to execute msys2.exe or mingw64.exe.
  3. Update the system :
 pacman -Syyuu
  1. If the shell tells you to close the terminal, close MSYS2 and run it again. That is a normal procedure.

Install the dependencies

Stable branch (GIMP 2.10) dependencies

If you have Windows 64bits:

pacman -S --needed \
    base-devel \
    git \
    mingw-w64-x86_64-toolchain \
    mingw-w64-x86_64-asciidoc \
    mingw-w64-x86_64-drmingw \
    mingw-w64-x86_64-gexiv2 \
    mingw-w64-x86_64-ghostscript \
    mingw-w64-x86_64-glib-networking \
    mingw-w64-x86_64-graphviz \
    mingw-w64-x86_64-gtk2 \
    mingw-w64-x86_64-gobject-introspection \
    mingw-w64-x86_64-iso-codes \
    mingw-w64-x86_64-json-c \
    mingw-w64-x86_64-json-glib \
    mingw-w64-x86_64-lcms2 \
    mingw-w64-x86_64-lensfun \
    mingw-w64-x86_64-libheif \
    mingw-w64-x86_64-libraw \
    mingw-w64-x86_64-libspiro \
    mingw-w64-x86_64-libwebp \
    mingw-w64-x86_64-libwmf \
    mingw-w64-x86_64-meson \
    mingw-w64-x86_64-mypaint-brushes \
    mingw-w64-x86_64-openexr \
    mingw-w64-x86_64-poppler \
    mingw-w64-x86_64-python2-pygtk \
    mingw-w64-x86_64-SDL2 \
    mingw-w64-x86_64-suitesparse \
    mingw-w64-x86_64-xpm-nox

If you have Windows 32 bit:

pacman -S --needed \
    base-devel \
    git \
    mingw-w64-i686-toolchain \
    mingw-w64-i686-asciidoc \
    mingw-w64-i686-drmingw \
    mingw-w64-i686-gexiv2 \
    mingw-w64-i686-ghostscript \
    mingw-w64-i686-glib-networking \
    mingw-w64-i686-graphviz \
    mingw-w64-i686-gtk2 \
    mingw-w64-i686-gobject-introspection \
    mingw-w64-i686-iso-codes \
    mingw-w64-i686-json-c \
    mingw-w64-i686-json-glib \
    mingw-w64-i686-lcms2 \
    mingw-w64-i686-lensfun \
    mingw-w64-i686-libheif \
    mingw-w64-i686-libraw \
    mingw-w64-i686-libspiro \
    mingw-w64-i686-libwebp \
    mingw-w64-i686-libwmf \
    mingw-w64-i686-meson \
    mingw-w64-i686-mypaint-brushes \
    mingw-w64-i686-openexr \
    mingw-w64-i686-poppler \
    mingw-w64-i686-python2-pygtk \
    mingw-w64-i686-SDL2 \
    mingw-w64-i686-suitesparse \
    mingw-w64-i686-xpm-nox

Unstable branch (GIMP 2.99) dependencies

If you have Windows 64bits:

pacman -S --needed \
    base-devel \
    git \
    mingw-w64-x86_64-toolchain \
    mingw-w64-x86_64-appstream-glib \
    mingw-w64-x86_64-asciidoc \
    mingw-w64-x86_64-drmingw \
    mingw-w64-x86_64-gexiv2 \
    mingw-w64-x86_64-ghostscript \
    mingw-w64-x86_64-glib-networking \
    mingw-w64-x86_64-graphviz \
    mingw-w64-x86_64-gtk3 \
    mingw-w64-x86_64-gobject-introspection \
    mingw-w64-x86_64-iso-codes \
    mingw-w64-x86_64-json-c \
    mingw-w64-x86_64-json-glib \
    mingw-w64-x86_64-lcms2 \
    mingw-w64-x86_64-lensfun \
    mingw-w64-x86_64-libarchive \
    mingw-w64-x86_64-libheif \
    mingw-w64-x86_64-libraw \
    mingw-w64-x86_64-libspiro \
    mingw-w64-x86_64-libwebp \
    mingw-w64-x86_64-libwmf \
    mingw-w64-x86_64-luajit \
    mingw-w64-x86_64-maxflow \
    mingw-w64-x86_64-meson \
    mingw-w64-x86_64-mypaint-brushes \
    mingw-w64-x86_64-openexr \
    mingw-w64-x86_64-poppler \
    mingw-w64-x86_64-python3-gobject \
    mingw-w64-x86_64-SDL2 \
    mingw-w64-x86_64-suitesparse \
    mingw-w64-x86_64-vala \
    mingw-w64-x86_64-xpm-nox

If you have Windows 32bits:

pacman -S --needed \
    base-devel \
    git \
    mingw-w64-i686-toolchain \
    mingw-w64-i686-appstream-glib \
    mingw-w64-i686-asciidoc \
    mingw-w64-i686-drmingw \
    mingw-w64-i686-gexiv2 \
    mingw-w64-i686-ghostscript \
    mingw-w64-i686-glib-networking \
    mingw-w64-i686-graphviz \
    mingw-w64-i686-gtk3 \
    mingw-w64-i686-gobject-introspection \
    mingw-w64-i686-iso-codes \
    mingw-w64-i686-json-c \
    mingw-w64-i686-json-glib \
    mingw-w64-i686-lcms2 \
    mingw-w64-i686-lensfun \
    mingw-w64-i686-libarchive \
    mingw-w64-i686-libheif \
    mingw-w64-i686-libraw \
    mingw-w64-i686-libspiro \
    mingw-w64-i686-libwebp \
    mingw-w64-i686-libwmf \
    mingw-w64-i686-luajit \
    mingw-w64-i686-maxflow \
    mingw-w64-i686-meson \
    mingw-w64-i686-mypaint-brushes \
    mingw-w64-i686-openexr \
    mingw-w64-i686-poppler \
    mingw-w64-i686-python3-gobject \
    mingw-w64-i686-SDL2 \
    mingw-w64-i686-suitesparse \
    mingw-w64-i686-vala \
    mingw-w64-i686-xpm-nox

Simply hit enter at the prompts for which packages to install (default=all). This step will download a ton of packages, and may take a while.

Building the software

You can now just follow the instruction on the main page Building GIMP . Just be careful of the following changes:

export GIMP_PREFIX=`realpath ~/gimp_prefix`
export PATH="$GIMP_PREFIX/bin:$PATH"
export PKG_CONFIG_PATH="$GIMP_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="$GIMP_PREFIX/share/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$GIMP_PREFIX/lib:$LD_LIBRARY_PATH"
  • If you are on Windows 64bits, you need to add mingw64 on 32bits mingw32
# environment variable for Autotools
export ACLOCAL_FLAGS="-I/c/msys64/mingw64/share/aclocal"
# environment variable for introspection
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$GIMP_PREFIX/share:/usr/local/share/:/usr/share/:/mingw64/share/"

You can add all the environment variable on C:\msys64_or_msys32\home\{USERNAME}\.bash_profile then run

. .bash_profile
  • Disable docs for babl: -Dwith-docs=false while calling meson.

  • Disable docs for GEGL: -Ddocs=false while calling meson.

You may want to disable the docs while building GIMP :

  • meson build : -Dgtk-doc=false -Dgtk-doc-app=false
  • autotools build : --disable-docs

Cross-Compiling GIMP under UNIX using crossroad

A tool named crossroad has been developed to cross-build for Windows under Linux (it was even originally started to crossbuild GIMP specifically).

Note that GObject-Introspection build (unstable branch only) is very hard when cross-compiling so it is usually disabled as an exception when a cross-compilation is detected. It is the only missing feature (GObject-Introspection is what allows bindings for plug-ins, such as Python, Lua, Vala…) for a cross-compiled GIMP. Yet some people manage to build the GObject-Introspection files, e.g. using yocto, which is why the meson configuration flag -Dcan-crosscompile-gir=true allows you to force GObject-Introspection build.

See the tutorial (outdated) explaining how to build GIMP with it .

Condensed, here is the process:

crossroad w64 gimp
crossroad source msys2
crossroad install \
    appstream-glib              \
    atk                         \
    cairo                       \
    drmingw                     \
    gexiv2                      \
    glib2                       \
    graphviz                    \
    json-c                      \
    ghostscript                 \
    iso-codes                   \
    json-glib                   \
    libheif                     \
    lcms2                       \
    libjxl                      \
    $LIBMNG                     \
    libmypaint mypaint-brushes  \
    libwebp                     \
    libwmf                      \
    openexr                     \
    poppler poppler-data        \
    xpm-nox

git clone git://git.gnome.org/babl
cd babl
crossroad meson ..
ninja && ninja install
cd ..

git clone git://git.gnome.org/gegl
cd gegl
crossroad meson ..
ninja && ninja install
cd ..

git clone git://git.gnome.org/gimp
crossroad configure --disable-python
make && make install

Check out the full tutorial for more details on how crossroad works.

Note: this is basically the same thing as the MinGW-w64 cross build, simply crossroad wraps all the complicated parts!

Cross-Compiling GIMP under Linux using MinGW-w64

Note: this section seems outdated, in build instructions, as well as the troubleshooting subsection. We keep it for historical reasons and also because it’s the base of how cross-compiling works. If anyone wishes to try this rawer cross-compilation build, don’t just copy-paste. Understand and adapt the commands to newer build system instructions.

Experience shows that working with the MinGW environment on a Linux machine provides a much faster compilation, and you are still able to compile for any Windows target (32 and 64 bits).

Notes:

  • The same limitation with GObject-Introspection exist as for the crossroad build .
  • The following procedure should be distribution-independent and does not rely on your package management system, even though it uses some OpenSuse packages. It would probably work on OSX or any other UNIX as well (add a note on the list below if you know this procedure works on another OS).

Has been known to work on at least: Linux Mint 15, Ubuntu 12.04LST and Mageia 2 distributions.

The source of the original procedure comes from an email by Victor Oliveira .

Install mingw-w64

This procedure relies on the newer MinGW-w64 project (forked from original MinGW project).

If your distribution provides the mingw-w64 tools, you may install them with your package manager.

Otherwise, download directly the last release .

The archive contains a prefix tree, that you can consider as read-only (just like your linux system).

Install GIMP Dependencies

The default environment provided by MinGW does not have the huge list of dependencies that GIMP requires.

Fortunately the email linked above has bash script named grab-stuff.sh (which calls itself a python3 script named download-mingw-rpm.py, so you have to download both and have python3), which downloads pre-compiled version of all needed dependencies for cross-compiling (it uses OpenSuse repositories as source, but it does not mean at all you need rpm support).

From the root of your cross-compiling prefix ($HOME/w64) run:

bash grab-stuff.sh

You will notice in particular a new usr/ folder, and inside i686-w64-mingw32/ and x86_64-w64-mingw32/ sub-folders.

⚠️ As you can see from the email date, this is a very old procedure, downloading an outdated list of packages. Chances are that it doesn’t work anymore, though the “concepts” are still the same. So to make it work, you will have to read both scripts, understand what they do, and fix them to use more recent OpenSuse repository and an updated package list.

ℹ️ This is actually one of the parts which crossroad greatly simplifies. The tool even support package sources from the MSYS2 project, various Fedora versions and OpenSuse.

Set your cross-compiling environment

Define the environment variables as described in Building GIMP . You may also need to reset pkg-config:

export PKG_CONFIG_LIBDIR=

Build BABL

git clone git://git.gnome.org/babl
cd babl
./autogen.sh --prefix=$PREFIX --host=$HOST --enable-introspection=no
make
make install

Build GEGL

git clone git://git.gnome.org/gegl
cd gegl
./autogen.sh --prefix=$PREFIX --host=$HOST --enable-introspection=no --disable-docs --disable-glibtest
make
make install

Build any optional dependency

This step is not necessary if you compile GIMP with the minimum set of dependency as indicated at the next section.

Compression support

Nevertheless if for instance, you needed compression support (hence be able to load and save your images in various compressed format), you would need zlib,libbzip2 and liblzma installed. In particular the cross-compilation environment described on this page has no pre-compiled liblzma. You would need to cross-compile it first yourself.

In my case xz-5.0.4 worked well.

cd ..
wget [http://tukaani.org/xz/xz-5.0.4.tar.xz http://tukaani.org/xz/xz-5.0.4.tar.xz]
tar xf xz-5.0.4.tar.xz
rm xz-5.0.4.tar.xz
cd xz-5.0.4
./configure --prefix=$PREFIX --host=$HOST
make
make install

Finally obviously in the GIMP configure step, remove the --without-liblzma option on the autogen.sh command line before compiling GIMP.

You should be able to do similar things for other optional features that you would want on your cross-compiled GIMP.

Alternatively there exists a patch to get compression support working in 32 bit builds.

Multi-Language support

Multi-Language support is installed with the grab-stuff.sh script. Due to a bug in the package mingw32-iso-codes-devel the pkgconfig program can’t find the iso-codes package. In this case you will notice, that GIMPs autogen.sh reports:

Language selection:  no

and the finished GIMP build has no language selector listbox in Edit/Preferences/Interface. To solve this, copy $HOME/w64/usr/$HOST/sys-root/mingw/share/pkgconfig/iso-codes.pc to $HOME/w64/usr/$HOST/sys-root/mingw/lib/pkgconfig before executing autogen.sh or configure for GIMP.

Note you have to do this for every value of $HOST you want to build (e.g. i686 and x86_64 architecture). Also merge the MinGW and GIMP build folders when installing it on Windows (see the Troubleshooting section ).

Build GIMP

cd ..
git clone <a class="external free" href="git://git.gnome.org/gimp" rel="nofollow">git://git.gnome.org/gimp</a>
cd gimp
./autogen.sh  --prefix=$PREFIX  --host=$HOST \
    --enable-introspection=no \
    --disable-glibtest \
    --disable-gtktest \
    --disable-docs \
    --without-libjpeg \
    --disable-python \
    --without-xmc \
    --without-dbus \
    --without-libzma \
make
make install

Install On Windows

To test your compiled installation, I found nothing better than moving the whole tree (in my case $HOME/w64) into Windows, because libraries are dynamically linked, then run $HOME/w64/bin/gimp-2.9.exe under Windows.

If you really want to build a self contained GIMP, you could try and compile everything as static libraries, though to be fair, we don’t do this and are not sure how many of our dependencies work fine this way. Feel free to contribute instructions for such a procedure if you compile GIMP this way.

In any case, GIMP would still rely on some external files, for instance what you find under $HOME/w64/share/gimp/2.0/, and maybe other data.

Troubleshooting

Running gimp-2.x.exe on Windows fails. Error messages about a missing entry point in libglib-2.0-0.dll or a missing bzip2.dll are shown.

Cause
The missing dll files are in the MinGW binary folder, which is separate from the GIMP folders.
Solution
To export the GIMP build to Windows properly, use the following steps:
  1. On Windows create a folder for the GIMP build, like GIMP-Master.
  2. Copy all files from $HOME/w64/$HOST/sys-root/mingw to the newly created folder.
  3. Copy all files from your $GIMP_PREFIX folder to the newly created folder. There are duplicate subfolders, for instance bin/, share/ etc., in both directories. If your filemanager asks you to overwrite them, then confirm.

It’s important to keep this order to ensure you overwrite older BABL and GEGL from the grab-stuff.sh script by the newer ones from your build.

At the end you have merged your MinGW installation and the GIMP build to a running GIMP on Windows build. (It also contains the unnecessary MinGW binaries, which are not needed anymore to run GIMP. But for testing purposes you have a running GIMP installation.)

Some fonts, like Sans, are shown improperly

See also the Bugzilla report .

Cause
The fontconfig package installation writes absolute paths of the building system to fonts.conf and conf.d/*.conf. When GIMP is installed on the Windows target system, these absolute paths become invalid.
Solution
The bug should be reported to the Fontconfig developers. Meanwhile do on the Windows target system:
  1. Close GIMP.

  2. Edit the file $GIMP_PREFIX\etc\fonts\fonts.conf: replace the line <include ignore_missing="yes">$a_directory/conf.d</include> by <include ignore_missing="yes">..\..\share\fontconfig\conf.avail</include>

  3. Restart GIMP.

Building GIMP using Microsoft tools

Microsoft Visual Studio comes with its own C compiler. Most of GIMP development is done with GCC and its MinGW or MinGW-w64 Windows ports, or Clang.

Unfortunately both are not fully compatible, so integrating GCC into the Visual Studio build chain has its flaws, even while it might work in some points.

Because of this you are currently recommended to use MinGW for building GIMP on Windows. Eventually we are for more genericity and are therefore not against a build working on more compilers or tools. If you wish to contribute fixes to make GIMP build with Microsoft Visual Studio, then maintain the build so that it continues working, you are welcome to contribute.

Building GIMP plug-ins using Microsoft tools

An old tutorial existed on the former registry (salvaged through archive.org) explaining how to build plug-ins using Microsoft tools: How to build a GIMP plug-in with Visual Studio

It might not be completely outdated, since plug-ins are a lot easier to compile than GIMP itself.

Packaging third-party GIMP plug-ins for Windows

Users on the Windows and Mac OSX platforms expect software to be packaged in a self-installing file (an installer). Even though GIMP plug-ins (whether scripts in Python or Scheme, or executables in the C language) are relatively easy to install, you might want to package them using an installer such as Inno Setup .