GIMP 2.4 has been released! It is the culmination of many man-years of real effort by several developers from around the world. There are many new things to expect in the new version, with more features, better usability and less bugs. Uncork your champagne and enjoy by upgrading to it.
Archive for the 'Graphics' Category
Following my last post on this subject where only the raw algorithm for finding the largest rectangle was completed, the UI and PDB changes for using this functionality are also done now (and several edge cases were fixed in the process). I’ll commit it once it gets some external testing from some of our esteemed customers
. All affine transformations now present a combo box with clipping modes:

Here is an example with rotation, using the excellent Wilber splash draft by Paul Davey and Jimmac (still no window decoration in the screenshots):



Thank you for Tom and Jerry.. you made me laugh even today.

GIMP now has working code to find the largest rectangle in the quadrilateral (aligned with the XY axes) which results after a transform (rotate, perspective, etc.). As an example, when a user rotates an image, she can decide to automatically crop the image to an rectangle aligned with the canvas so that no transparent areas are introduced (an often used use-case which is used usually often
). A UI for using this feature will be available soon.
The shapes below are from a GTK+ test program which uses Cairo to draw, but when I took screenshots, the window decoration disappeared (maybe because of desktop effects). The black polygon is the transformed quadrilateral and the green rectangle is the computed result. The function also accepts an aspect ratio to provide a properly sized rectangle.

Graphics Planet bloggers who haven’t got hackergotchis setup should send me theirs so I can put it up
. Extra points for those who mixter it.
In case you haven’t heard, the next Libre Graphics Meeting is going to be held in Canada in May next year. If you’re intested in attending, please read the post at the second link and contact Louis Desjardins.
Following up on the last post, we now have smoother loglog smoothing, for the Fractal Explorer plug-in of GIMP. Mmmm. Will be committed after some cleanups of the plug-in code though.
I keep saying that cooking, unless one’s doing it for recreation, is crazy as one spends way too much time cooking and cleaning up than eating the result. Fixing bugs is something like this, but worse. It’s probably someone else’s code who wrote it back in 1999 and somehow the bug has been there all along undiscovered; you know where the bug is; you probably even know how to quick-fix it; but to really fix the bug knowing what you’re doing means having to understand the code. Take a graphics application and you spend more time following the code. You spend a few hours doing that, and then the patch to fix it is 6 lines long, and it’s something very very simple. You put an if somewhere to handle a condition.
Last week, the Fractal Explorer plug-in of GIMP had a bug like this. The code for handling the loglog checkbox was added back in 1999. It has never worked on the complete classic Mandelbrot set (or if it ever did work, that must have been due to a bug in some other product). Looks like nobody used it like that. Kevin Cozens was porting the plug-in to GEGL when he discovered that it crashed with the loglog setting (#372671).

For a Mandelbrot set, the classic method of rendering the set is to map the escape loop counter (once the modulus has escaped) directly to a colormap. This counter is an integer and the method causes banding due to non-smooth shading. The loglog implementation uses a method by Linas Vepstas to renormalize the escape loop counter by finding out how far away the integer counter has strayed outside the escape radius. It involves calculating a double log to map z^(2^i) to i, i.e., log (log (|z|^(2^i))) / log (2). The final divide by log (2) is so that the outer logarithm is done to the base 2 to reduce the 2^i to i. For reference, the end-result normalized loop counter is calculated as: mu = N - log (log (|Z(N)|)) / log (2) where N is the integer escape counter.
The problem with this method was that in the “inner lake” of the Mandelbrot set, where for example c can be 0 + 0i, the loop always exits after a full run with the loop counter at the maximum value, and |z| < 2.0. When |z| < e, the double log starts returning negative values. When |z| < 1, the double log returns inf. This is then subtracted from N and the resulting value mu is used to lookup RGB values for the point from the colormap array. This caused the plug-in to crash (when inf is used or mu exceeds the length of the colormap array).
So what we did to fix this was check to see if |z| < e at the end of the escape loop and clamp mu to N - 1 in that case. The result:
Classic smoothing (or lack of it):
![]()
Open them in two tabs to see how they differ. Of course, as we still use entries directly from a colormap (after rounding), it isn’t as smooth as we’d really like, but interpolation using the real values should be an exercise for another day. Now fixing the actual bug was a 2-line if condition. Imagine hours spent studying the algorithm used, and a 2-line fix (and perhaps this lousy blog post). The plug-in still needs to be fixed as it’s got the code for the fractal algorithms repeated for the actual filter and for the dialog’s preview, which needs to be moved to a common function, and we’d like to implement the really smooth shading as well.
Do you find all this cooking interesting? Do you want to be a GIMP developer? Come and participate by picking an open bug and hacking it into submission. Join #gimp on irc.gimp.org to talk to developers, or the gimp-developer mailing list. Or you may want to try #gegl if you think you’ve got the sk1llz.
Graphics Planet is a new “planet” website using the Planet Feed Reader and based on Planet GNOME’s silverorange theme which was generously sent to me by Steven Garrity for use with Graphics Planet.
Graphics Planet is about the world of people involved in free software development in the field of computer graphics and publishing. We are users and developers on programs such as GIMP, Blender, Inkscape, Scribus, Krita, and other related projects such as the Tango Desktop Project.
If you are a contributor to free software in the field of computer graphics, you may already find yourself on it. If you are a developer on an existing graphics software project distributed under a free software license, or an artist who uses free software and have contributed artwork to free software projects, you are welcome to have your blog added on Graphics Planet. Please mail me.
bolsh: Even I want to support that Sven and Mitch are two great people to work with in a project. They are very helpful and excellent models (in the people sense
). They guide you well if you’re trying to implement a feature or bugfix. I’ve also thought Sven was abrupt sometimes before, but I know that it’s because he’s being upfront and is harmless. There’re so many things to do, and few people with less time, so sometimes it can be frustrating. Language is also a barrier for non-native English speakers.
Btw, to all GNOME and other programmer people: GIMP is always looking for more developers. GIMP is well designed and very easy to write code for. So if you want to write some cool code, check out the open list of issues and enhancement proposals and see what you can help with. Also read HACKING and the plug-in development documentation. If you want to work on an issue or enhancement, or even something cool you think you want to do for GIMP, you can either join #gimp or use the gimp-developer mailing list and discuss it.
Remember Cubic? That demo group from the 90s which made Cubic Player, the only program which could decode an MP3 in real-time on a 486 CPU? I was browsing a page about compact ELF programs today and remembered this: they had written a demo program called digi.com which is 7030 bytes in size and displays a texture-mapped torus spinning and deforming around, to accompanying MIDI music. It renders it full with specular highlights and transparency, all in 7030 bytes. No kidding. Try it under DOSBox. Screenshots to whet your appetite:
Happy Teachers’ Day to all teachers!