GEGL gets mipmaps, 71 new image processing operations


GIMP’s new image processing engine got its first update in three years, and it’s so full of awesome you’d cry and demand GIMP 2.10 released right next to it.

Supernova GEGL operation in dev. build of GIMP

Supernova GEGL operation in development build of GIMP

A lot of work has gone into making GEGL faster. There’s still a lot of work to be done, but the new version features major improvements such as:

Better thread-safety and experimental multithreading support. You can run e.g. ‘$ GEGL_THREADS=4 gimp-2.9’ from terminal window. But don’t expect this to automagically improve performance: it still needs a lot of testing, and developers are interested in thoughtful reports.

Experimental mipmaps support. If you are not familiar with mipmaps, here’s the basic idea. Instead of working on a huge image in its entirety, an application generates a smaller version of the original image and processes it for preview. While you are evaluating the preview, it silently chews the real thing in the background. Again, it’s an experimental feature currently not used by GIMP, whether it will prove to be GIMP 2.10 material depends on contributors activity.

New default tile backend writes to disk in a separate thread. This should make GIMP more responsive while saving/exporting files.

GEGL 0.3 also got 71 new image processing operations. Mostly they are ports of existing GIMP filters, and that automatically makes them eligible for the future non-destructive editing workflows. A lot of that work was done by Thomas Manni who is among the most silent and hard-working GEGL contributors of late.

However, porting GIMP filters to GEGL doesn’t necessarily end at writing a GEGL operation and compatibility code for GIMP to keep the operation accessible for plugins and scripts. Some GEGL filters like the Fractal Explorer have a lot of options, hence automatically generated user interface may simply not fit even a 4K display vertically.

Automatically generated UI for Fractal Explorer port on a 1920x1280 display

Automatically generated UI for Fractal Explorer port on a 1920x1280 display

To fix that one needs to write a custom user interface in GIMP. This started creeping into GIMP’s code base about a year ago. Diffraction Patterns operation is among notable examples of making a familiar interface with all the benefits of using GEGL tool’s skeleton, such as presets and live preview on canvas.

Diffraction Patterns has a compact custom user interface much like the original GIMP plugin

Diffraction Patterns has a compact custom user interface much like the original GIMP plugin

On a related note, one of slightly nerdy new features of this GEGL release is ‘ui_meta’. Basically, now GEGL operations can provide useful hints to GEGL-based applications about best ways to render user interface for various properties.

Here are just a few examples. If you want GIMP to display a rotary widget for the quick setting of an angle, you can add ‘ui_meta (“unit”, “degree”)’ to the property in question.

Rotary widget for quickly choosing an angle in development build of GIMP

Rotary widget for quickly choosing an angle in development build of GIMP

The (“unit”, “relative-coordinate”) meta will create a button next to input field, by clicking which you will be able to pick a relative position from your image, for example, the center for a Zoom Motion Blur effect.

Additionally, if there are two adjacent properties, where the first one has (“axis”, “x”) meta, and the other one has (“axis”, “y”), GIMP will create a chain button for these two values, so that you could e.g. lock ratio between the two values or keep them equal.

X and Y values can be locked to each other, and you can pick a relative position

X and Y values can be locked to each other, and you can pick a relative position

More work needs to be done on range of proprerties’ values exposed in user interface.

But wait, there’s more. Jon Nordby backported all the changes to GEGL he made while working on The Grid, an artificial intelligence based CMS that relies on GEGL for all image processing work. One of them is reading custom GEGL operations written as JSON files.

img_flo web app for creating node compositions with GEGL operations

img_flo web app for creating node compositions with GEGL operations

The idea is to reuse the concept of meta-operations already available in GEGL for a very long time. E.g. such a core filter as unsharp mask is actually a meta-operation that combines the use of several other operations: add, multiply, subtract, and Gaussian blur. You can create your own meta-operations of any complexity with img_flo web app, then use them from within GIMP.

Finally, just to avoid confusion, newly released GEGL 0.3 is not something you can “install” into existing stable version of GIMP and automatically get all the new features. It’s best to treat this as a foundation of what’s coming in GIMP 2.10 and beyond.

92 people contributed to making GEGL 0.3 happen, but there’s still plenty of contribution opportunities for everyone: porting more filters, improving default range of values, descriptions etc., making further performance improvements, adding new exciting features