Goat Invasion in GIMP
Once upon a time, like 5 weeks ago, there used to be the longstanding plan to, at some point in the future, port GIMP to GEGL.
We have done a lot of refactoring in GIMP over the last ten years, but its innermost pixel manipulating core was still basically unchanged since GIMP 1.2 days. We didn’t bother to do anything about it, because the long term goal was to do all this stuff with GEGL, when GEGL was ready. Now GEGL has been ready for quite a while, and the GEGL porting got assigned a milestone. Was it 2.10, 3.0, 3.2, I don’t remember. We thought it would take us forever until it’s done, because nobody really had that kind of time.
About 5 weeks ago, I happened to pick up Øyvind Kolås, aka Pippin the Goatkeeper to stay at my place for about a week and do some hacking. After one day, without intending it, we started to do some small GEGL hacking in GIMP, just in order to verify an approach that seemed a good migration strategy for the future porting.
The Problem: All the GimpImage’s pixels are stored in legacy data structures called TileManagers, which are kept by high level objects called GimpDrawables. Each layer, channel, mask in GIMP is a GimpDrawable.
A typical way to do things is:
TileManager *tiles = gimp_drawable_get_tiles (drawable);
PixelRegion region;
pixel_region_init (®ion, tiles, x, y, w, h, TRUE);
/* do legacy stuff on the pixel region in order to change pixels */
After the GEGL porting, things would look like that:
GeglBuffer *buffer = gimp_drawable_get_buffer (drawable);
/* do GEGL stuff on the buffer, like running it through a graph in order to change pixels */
Just, how would we get there? Replacing the drawable’s tile manager by a buffer, breaking all of GIMP at the same time while we move on porting things to buffers instead of tile managers? No way!
The Solution: A GeglBuffer’s tiles are stored in a GeglTileBackend, and it’s possible to write tile backends for arbitrary pixel storage, so why not write a tile backend that uses a legacy GIMP TileManager as storage.
After a few hours of hacking, Pippin had the GimpTileBackendTileManager working, and I went ahead replacing some legacy code with GEGL code, using the new backend. And it simply worked!
The next important step was to make GimpDrawable keep around a GeglBuffer on top of its TileManager all the time, and to add gimp_drawable_get_buffer()
. And things just kept working, and getting easier and easier the more legacy code got replaced by GEGL code, the more GeglBuffers were being passed around instead of TileManagers and PixelRegions.
What was planned as a one week visit turned into 3 weeks of GEGL porting madness. At the time this article is written, about 90% of the GIMP application’s core are ported to GEGL, and the only thing really missing are GeglOperations for all layer modes.
As a totally unexpected extra bonus, there is now even a GEGL buffer tile backend in libgimp, for plug-ins to use, so also plug-ins can simply say gimp_drawable_get_buffer(drawable_ID)
, and use all of GEGL to do their stuff, instead of using the legacy pixel region API that also exists on the plug-in side.
GIMP 2.10’s core will be 100% ported to GEGL, and all of the legacy pixel fiddling API for plug-ins is going to be deprecated. Once the core is completely ported, it will be a minor effort to simply “switch on” high bit depths and whatever color models we’d like to see. Oh, and already now, instead of removing indexed mode (as originally planned), we accidentally promoted indexed images to first class citizens that can be painted on, and even color corrected, just like any other image. The code doing so doesn’t even notice because GEGL and Babl transparently handle the pixel conversion magic.
The port lives in the goat-invasion branch in GIT. That branch will become master once GIMP 2.8 is relased, so the first GIMP 2.9 developer release will already contain the port in progress.
If you want to discuss GIMP and GEGL things with us face to face, join us at this year’s Libre Graphics Meeting in Vienna, in two weeks from now, a lot of GIMP people will be there; or simply check out the goat-invasion branch and see the goats yourself.
If you have some Euros to spare, consider donating them to Libre Graphics Meeting, it’s one of the few occasions for GIMP developers, and the people hacking on other projects, to meet in person; and such meetings are always a great boost for development.
During the 3 crazy weeks, quite some work time hours were spent on the port, thanks to my employer Lanedo for sponsoring this via “Labs time”.
April 17th, 2012 at 15:44
Great work !
Glad to see work has been done on the GEGL front !
April 17th, 2012 at 15:46
Thank you! Thank you, thank you, thank you!
April 17th, 2012 at 16:11
simply amused, and happy, especially because this will allow 16bit per channel.
Congratulations
April 17th, 2012 at 16:22
As much as I like to see an GEGL enabled Gimp and the stuff you two had done is really really great, wouldn’t it be more impotent to first get Gimp 2.8 ready?
April 17th, 2012 at 16:30
Thank you very much for this work. It is highly appreciated!
Are there any effects on GIMPs performance?
April 17th, 2012 at 16:51
Before this post, I was very frustrated that the GIMP 2.8 release seemed to slip and slip. Now I understand what you are doing. Photographers desperately need 16-bit per color, so your keep up the amazing, amazing work.
Best, Radzfoto.
April 17th, 2012 at 17:46
I cant express how seriously cool you guys are.
I too have wondered how long it would take to get GEGL into gimp when it has taken so long to get 2.8 out the door. And then you guys go and port most of it over in weeks..!? Madness is right… 🙂
It must feel very good as well making it easier to work with gimp with a better core?
Congratulations and looking forward to LGM to hear from all of you.
April 17th, 2012 at 17:53
@tobias: The code of GIMP-2.8 was feature frozen when the goat-invasion started. What keeps it back is testing and packaging, by users and packagers on multiple distros – along with filed bugs and patches to fix issues arising, as well as perhaps a splash that people agree upon.
IMHO though, getting GEGL integrated was important than releasing GIMP-2.6 The goats have been waiting to be properly let in and rule GIMP since before that release, and even back then that plan was many years overdue.
April 17th, 2012 at 17:59
Tobias, what a great idea! I’m sure the team are excitedly awaiting your first patch.
April 17th, 2012 at 18:19
I just stopped to wait the 2.8 release and started to look forward for the future 2.9/2.10…thank you very much guys! … XD 😉
great work!
April 17th, 2012 at 18:58
That’s awesome.
April 17th, 2012 at 19:03
This is *fantastic* news! It seems you reached the point where the initial refactoring is really hard, but then something happens and the code starts writing itself. Can’t wait for the goatified Gimp!
April 17th, 2012 at 19:21
Tobias: And waste the opportunity to hack together on something that’s really fun? Absolutely not 🙂
April 17th, 2012 at 19:25
Way to go, guys!
April 17th, 2012 at 19:26
Thank you and Øyvind Kolås, and all the GIMP/GEGL/babl devs for all your work!
April 17th, 2012 at 20:12
I for one, welcome our 16 bit GEGL enabled Goat overloards!
Great hacking guys!
April 17th, 2012 at 20:31
[…] his blog, Michael Natterer writes about some major progress in making GIMP work with the Generic Graphics Library (GEGL), which will […]
April 17th, 2012 at 21:10
Awesome news! Can’t wait for the new version of Gimp…
April 17th, 2012 at 22:04
Will a full port to GEGL allow me to load in DNG files with full support?
Say, I loaded a DNG file, performed color correction, and then exported as JPEG. Would the JPEG include all the EXIF metadata the DNG file had?
April 17th, 2012 at 22:12
@Michael Mol: No, GEGL porting and metadata handling are completely unrelated.
April 17th, 2012 at 23:12
Woot, nice accidental work there pippin, congrats!
So…when are you gonna merge GIMP into Blender? 😉 jk, cya o/
April 17th, 2012 at 23:29
[…] my way to bed I stumbled across a blog post by Michael Natterer (Mitch), one of the core developers of GIMP. Øyvind Kolås (Pippin) and he […]
April 18th, 2012 at 00:02
Thanks a lot! This seems to be the best start to kick-off gimp again. I hope that you can now easily identify EasyHacks for newcomers to the project. LibreOffice did that quite successfully. I hope Gimp manages this, too! I really looking forward to testing 2.9.X
April 18th, 2012 at 01:10
Hi, i’ve donated $40.00 to Libre Graphics Meeting as suggested since i really like Gimp and want to support your work 🙂
Thank you !
April 18th, 2012 at 01:13
Great, great job guys. Excellent.
April 18th, 2012 at 03:05
Wow pal,
Truly superb penmanship for a programmer. A fine example of when stereotypes aren’t always true. Congratulations on deciphering the surely monumental task which lied ahead of you. And gratitude for continuing the advancement of the lovable GIMP project forward.
April 18th, 2012 at 03:27
Really really really good news – well done!
April 18th, 2012 at 04:24
That’s great work. Too bad nobody had this brilliant idea five years ago – but then again, I probably should be thankful that you had it at all. 😉
April 18th, 2012 at 06:22
Thank you so much Mitch and pippin. 🙂
Have just donated 50 bux.
Keep up the good work!
April 18th, 2012 at 07:27
Amazing, thanks for all your work. I’ve been using GIMP and I prefer it a lot to other solutions (Photoshop, etc).
BTW, not to be nitpicky but you misspelled some words:
stategy -> strategy
lagacy -> legacy
accidentially -> accidentally
April 18th, 2012 at 07:32
[…] ported to a new generation of non-destructive graphics core GEGL. Now, developer Michael Natterer announced the progress of the transplant , said to have completed 90% of the core code portability. GEGL will be able to provide many new […]
April 18th, 2012 at 08:43
Found this blog post on Slashdot. As a long time Gimp user I found it interesting to read how you guys work. And it seems you know what you’re doing. Respect!
April 18th, 2012 at 09:12
Thanks to the anonymous nitpicker fo pointing out the typos, fixed 😉
April 18th, 2012 at 09:33
just wondering, if HTML5 canvas as backend is worth to be considered or not 😉
GIMP over web….
April 18th, 2012 at 09:44
@Tobias – I stopped watching for GIMP updates years ago as 8bpc is a show-stopper for photo editing (just think how much detail is lost from a camera producing 14-bit per channel images – 2x2x2x2x2x2 levels).
Now I really look forward to a return to GIMP.
Fantastic work – thanks.
April 18th, 2012 at 10:26
Yeah – great thing! Congratulations and thank you.
Finally, this also gets Gimp+GEGL far far away from Duke Nukem Forever 😉
April 18th, 2012 at 10:56
90% are done, there’s only the other 90% to do now 🙂
April 18th, 2012 at 11:32
[…] già al futuro: il progetto pare aver ripreso vitalità negli ultimi mesi infatti, ed è stato formalmente annunciato che GIMP 2.9 sarà portato a GEGL in tutto il core del […]
April 18th, 2012 at 11:47
[…] GIMP объÑвили о завершении оÑновных Ñтапов перевода Ñдра […]
April 18th, 2012 at 12:05
[…] Veröffentlichung von Gimp 2.8 lässt weiter auf sich warten, dennoch gibt Hauptentwickler Michael Natterer nun in seinem Blog an, Gimp 2.10 werde vollständig auf der Grafikbibliothek Gegl basieren. Dies bringt unter anderem […]
April 18th, 2012 at 12:26
@guest: did you see the broadway GTK+ backend demo running GIMP?
http://blogs.gnome.org/alexl/2011/04/18/broadway-update-3/
April 18th, 2012 at 13:35
[…] Veröffentlichung von Gimp 2.8 lässt weiter auf sich warten, dennoch gibt Hauptentwickler Michael Natterer nun in seinem Blog an, Gimp 2.10 werde vollständig auf der Grafikbibliothek Gegl basieren. Dies bringt unter anderem […]
April 18th, 2012 at 13:40
Thank you. This will Gimp give an huge step forward.
April 18th, 2012 at 15:14
First of all I forget to say thank you for the work. And now to the comments:
@Øyvind
I can see your points and the best thing is, that it helped to motivate you.
@David
My first patch was 2007, but C is not my language. But there are other areas where I help GIMP.
@Mitch
Best reason to do some thing ever.
@gary
The “high bit depths” support is really missing in GIMP, but GiMP is even without it a great tool.
April 18th, 2012 at 18:18
Awesome work, thank you so much for your effort. I have many friends that use GIMP understand what you are doing and are also very appreciative.
April 18th, 2012 at 21:00
[…] | GIMP foo Related Posts:GIMP 2.8 en la recta final, publicada la primera versión candidataGIMP 2.7.5 […]
April 18th, 2012 at 22:17
[…] GIMP объÑвили о завершении оÑновных Ñтапов перевода Ñдра […]
April 19th, 2012 at 00:16
[…] trabajar con una profundidad de color de 16 bits en las operaciones gestionadas por la librerÃa. Fuente | Gimp Foo Tweet (function() { var li = document.createElement(‘script’); li.type = […]
April 19th, 2012 at 08:10
[…] VÃa | GIMP foo […]
April 19th, 2012 at 09:23
@Tobias ‘“high bit depths†support is …missing … but GiMP is even without it a great tool.’
For some things, yes. For a photographer I’m sad to say that it’s a non-starter. As soon as high bit-depth is introduced, I’ll happily switch back – and hopefully the other essential feature – adjustment layers -won’t be too far behind.
Again – great work, and thanks
April 19th, 2012 at 17:47
This is really exciting. Keep up the great work. 🙂
April 19th, 2012 at 20:41
[…] siÄ™ w koÅ„cu opracować strategiÄ™ migracji. Podczas pracy nad tym zobaczyli, że zaczÄ™li zajmować siÄ™ już portowaniem. Teraz okoÅ‚o 90% rdzenia GIMP-a zostaÅ‚a przeportowane na GEGL. Po zakoÅ„czeniu tego dziaÅ‚ania, […]
April 19th, 2012 at 21:42
[…] Goat Invasion in GIMP We have done a lot of refactoring in GIMP over the last ten years, but its innermost pixel manipulating core was still basically unchanged since GIMP 1.2 days. We didn’t bother to do anything about it, because the long term goal was to do all this stuff with GEGL, when GEGL was ready. Now GEGL has been ready for quite a while, and the GEGL porting got assigned a milestone. Was it 2.10, 3.0, 3.2, I don’t remember. We thought it would take us forever until it’s done, because nobody really had that kind of time. […]
April 20th, 2012 at 21:08
Great news! Thanks!
April 22nd, 2012 at 12:47
I’m glad to see you finally bring higher bit-depth to Gimp. As Gary already wrote, 8 bit is a show-stopper for photographers (at least those that aspire more than a snapshot look).
I’m really looking forward to give Gimp another try, once high bit-depth is available.
Will adjustment layers also be available shortly?
Thanks for your hard work and bringing about an important change.
April 28th, 2012 at 15:29
[…] then there is an invasion of goats int GIMP and 16 bits and more are in […]
April 28th, 2012 at 16:40
Hi Mitch,
Interesting post. It would be great if you would be a contributor to GIMP Magazine on GIMP development related items. Contact info is on our http://www.twitter.com/GIMPMagazine
Thanks
Steve
April 29th, 2012 at 02:55
@ heiko
Please read this http://blog.mmiworks.net/2012/01/gimp-full-gegl-ahead.html
April 30th, 2012 at 18:32
Thanks for this work, we use GIMP for our work at http://www.flor360.com there’s a lot of things done in GIMP (mainly because its auto white balancing and nice unsharp filters).
Thanks for the good work!
May 4th, 2012 at 10:42
Wonderful news, I feel very excited. Does this mean the road map will be modified and high bit depth will move into 2.10 rather than 3.0 ?
May 6th, 2012 at 02:14
guys!
This is so awesome i can’t describe it!
When 16-bit/channel is ready i can simply ditch photoshop and use gimp for all my photographic needs. this is the last feature before gimp will be a real(like REAL!) photoshop alternative and i’m looking forward to this.
thank you for all your hard work.
much love and appreciation
benni
May 7th, 2012 at 22:48
[…] proprietary solutions so far. Øyvind KolÃ¥s a.k.a. pippin with some Gimp developer talked about Gegl integration in GIMP. Recently a huge step was made towards integrating this very fast, important back-end (e.g. 16 bit […]
May 24th, 2012 at 20:10
[…] con una profundidad de color de 16 bits en las operaciones gestionadas por la librerÃa. VÃa | GIMP foo Fuente: […]
June 2nd, 2012 at 22:56
[…] turned out to a 3 weeks hackaton were 90% of the GIMP core was ported to GEGL. It is worth reading Mitch’s blog on the subject – picked by Slashdot where the whole discussion was about the hackers […]
June 12th, 2012 at 14:44
[…] GIMPå¼€å‘者去年宣布了GIMP 2.8åŽç»å¼€å‘计划,其ä¸é‡è¦çš„一æ¥æ˜¯å°†æ ¸å¿ƒå›¾å½¢ä»£ç 移æ¤åˆ°æ–°ä¸€ä»£éžç ´å性图形处ç†æ ¸å¿ƒGEGL。现在,开å‘者Michael Natterer 公布了移æ¤è¿›åº¦ï¼Œè¡¨ç¤ºå·²å®Œæˆ90%çš„æ ¸å¿ƒä»£ç 移æ¤ã€‚GEGL将能æ供许多新特性,包括高ä½æ·±åº¦ï¼ˆhigh-bit-depth)支æŒã€‚未æ¥å‘布的GIMP 2.10æ ¸å¿ƒä»£ç å°†100%移æ¤åˆ°GEGL。 […]
September 13th, 2012 at 16:19
Wow this is an amazing news for us designers. hope we ca utilize this update.I cant wait to experiment something new in GIMP
January 20th, 2013 at 21:18
[…] in short, this is Gimp 2.91, which eventually become 2.10 with full GEGL, Port. After this, GIMP 3.0 will come with GTK 3. No dates available! […]
March 30th, 2013 at 22:15
Thank you for doing and posting this. GIMP is the way to go and having community like this to expand functionality is amazing.
November 22nd, 2015 at 08:42
[…] Gimp seine feine Text-Engine, die folgenden Events standen im Zeichen von GEGL. Während einer Gimp-GEGL-Hacking-Woche im Jahr 2012 erprobten Michael Natterer und Øyvind Kolås eine Migrationsmethode, die sich als […]
March 8th, 2016 at 22:45
[…] capabilities uses GEGL, the graph based image processing framework set to be the new image processing core of […]
March 10th, 2016 at 20:49
[…] new editing capabilities uses GEGL, the graph based image processing framework set to be the new image processing core of […]
June 2nd, 2016 at 01:38
Thanks once again for the push!