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.

Building GIMP natively under Windows using MSYS2

MSYS2 is a project that provides basically everything you would need (package manager, compiler…) to build Windows software.

Running, from GIMP source, build\windows\1_build-deps-msys2.ps1 then build\windows\2_build-gimp-msys2.ps1 might be all there is to do. To better understand the compilation flow, you may read below.

Install the dependencies for GIMP

  1. First, if you don’t have MSYS2 installed, simply run in PowerShell:
winget install MSYS2.MSYS2
  1. To be able to easily use MSYS2 packages, you need to add it to PATH. So, set $MSYSTEM_PREFIX to clangarm64 (for ARM 64-bit) or clang64 (x86 64-bit), then:
$env:Path = "C:/msys64/$MSYSTEM_PREFIX/bin;C:/msys64/usr/bin;" + $env:Path

For 2.10 series, however, just open MINGW64 (for x86 64-bit) or MINGW32 (x86 32-bit) terminal (you can find these shortcuts on the Start Menu).

  1. Update the system:
pacman -Syyuu

If you are working in 2.10 series and the shell tells you to close the terminal, close it and run again. That is a normal procedure for these terminals.

  1. Dependencies are installed with the following command:

Stable branch (GIMP 2.10) dependencies

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

Note that $MINGW_PACKAGE_PREFIX is defined internally by the MSYS2 shell. You don’t need to manually change it.

Unstable branch (GIMP 2.99) dependencies

Set $MINGW_PACKAGE_PREFIX to mingw-w64-clang-aarch64 (for ARM 64-bit) or mingw-w64-clang-x86_64 (x86 64-bit) triplet. Then, from GIMP source, run:

pacman --noconfirm -S --needed base-devel $MINGW_PACKAGE_PREFIX-toolchain (Get-Content build/windows/all-deps-uni.txt).Replace('${MINGW_PACKAGE_PREFIX}',$MINGW_PACKAGE_PREFIX).Replace(' \','')

This step will download a ton of packages, and may take a while.

Prepare for building

On Windows shell, environment variables are defined this way:

$GIMP_PREFIX = "${HOME}\_install".Replace('\', '/')

$env:Path = $env:Path + ";$GIMP_PREFIX/bin"
$env:PKG_CONFIG_PATH = "C:/msys64/$MSYSTEM_PREFIX/lib/pkgconfig;C:/msys64/$MSYSTEM_PREFIX/share/pkgconfig;$GIMP_PREFIX/lib/pkgconfig"
$env:XDG_DATA_DIRS = "C:/msys64/$MSYSTEM_PREFIX/share;$GIMP_PREFIX/share"
$env:GI_TYPELIB_PATH = "C:/msys64/$MSYSTEM_PREFIX/lib/girepository-1.0;$GIMP_PREFIX/lib/girepository-1.0"

Building the software

You can now just follow the instruction on the main page Building GIMP. Just be careful that the following options should be added at meson setup:

🚧 babl dev docs are broken. Disable them while calling meson at babl building: -Dwith-docs=false.

🚧 GIMP dev docs are broken. Disable them while calling meson: -Dg-ir-doc=false; or autotools: --disable-docs.

Once built, you can run gimp*.exe through the bundle generated in $GIMP_PREFIX. Also, it’s possible to run it from terminal using a .ps1 profile.

Building GIMP using Microsoft tools

Microsoft Visual Studio comes with its own C compiler know as MSVC. Most of GIMP development is done with Clang or GCC compilers (provided by MSYS2).

🚧 GIMP do not build on MSVC. If you wish to contribute fixes to make GIMP build with Microsoft VS, then maintain the build so that it continues working, you are welcome to contribute.

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 and is used until today in our CI builds).

We recommend to check out the scripts build/windows/1_build-deps-crossroad.sh and build/windows/2_build-gimp-crossroad.sh for more details on how crossroad works.

🚧 crossbuilds do not support introspection. Because GObject-Introspection build (which allows bindings for plug-ins, such as Lua, Python, Script-Fu, Vala) is very hard when cross-compiling so it is usually disabled as the only feature exception when cross-compiling. Since introspection is needed to run Python scripts at build time, you will need to build GIMP natively on UNIX before crossbuilding. Patches are welcome.

Packaging third-party GIMP plug-ins for Windows

Users on the Windows and macOS platforms expect software to be packaged in a self-installing file. Even though GIMP plug-ins are relatively easy to install, you might want to package them using an installer such as Inno Setup for the traditional version, or Windows SDK for the Store version.