Pages

Monday, August 29, 2011

[GSoC-2011] Final Results and How to Try

I am very glad to announce that I now officially passed the Google-Summer-of-Code 2011 :) The email from Google arrived in the last few days, and the official Google announcements on the GSoC results (of all projects) are supposed to be published tomorrow.

Now, it’s time to publish the instructions on how to get and try it for the people who want to test it. There are some known bugs, and probably some unknown bugs, so be warned.

Compilation and Set-Up Instructions

You should know how to build of GIMP and GEGL from Git. A partially outdated guide is available here, and some things are explained in more depth here.

Instead of building the GEGL master (main) branch, switch to the soc-2011-seamless-clone branch. You can do this by running git checkout soc-2011-seamless-clone. Compile it with the regular flags – nothing special is needed.

After building the updated version of GEGL, it’s time to build the updated version of GIMP. Switch to the soc-2011-seamless-clone2 branch, and build it.

Before running GIMP, you must set the environment variable p2t_refine_steps to some number defining the maximal amount of points to be used in the mesh (in plain English, more should theoretically produce better result). I know this is annoying, I will get rid of it as soon as I finish debugging a certain code part. The typical number I use is 500 for pastes of around 200x200 pixels, and you should probably increase it if you wish to work on large pastes.
If you are using the bash terminal, do export p2t_refine_steps=500 (and change the number as you wish)

Run GIMP.

Usage Instructions

Basically, you can just try copying a part, selecting the Seamless Clone tool (Shift+L) and clicking anywhere on the image to start the tool’s interaction. Click Enter to apply the final result. If this doesn’t work (and/or crash), then the instructions below are for you.

Run Gimp :)

Open the image that you wish to use as the background, and open the image you wish to paste into the background.
Copy the part you want to paste. Note that opacity of that part will be treated as if it was binary – parts under 50% opacity will be removed, parts of more than 50% opacity will be completely opaque. The shape can be any shape, as long as it follows the following rules:

It must not have holes (Temporary limitation)

It must be continuous, i.e. composed of only one part (Temporary(?) limitation)

It must not have any long thin areas (Temporary(!) limitation).This means that if you have any area which is 1 pixel wide and is 3 pixels long or more (i.e. a thin spike), it will crash. Solution for this was already devised, I just need to code it.
Select the Seamless-Clone Tool (Either by clicking the second tool on the toolbox that has the same icon as the move tool, or by doing Shift+L).

Click anywhere on the canvas while the background layer is active. The paste will be centered on the cursor, and so the cursor should be in a place where the entire paste is inside the background boundaries (both inside the rectangle defining the layer, and inside an area where all the background below it is opaque). This limitation will be enforced by the User Interface later.

Move the paste by clicking on it, dragging and releasing. If you move it slow enough (which actually shouldn’t be so slow), you’ll see the preview updating while you are moving.

Click Enter to Apply the effect.

Known Bugs

All the above mentioned crashes and bugs :)

Due to not yet complete memory management, the tool leaks memory from it’s preprocessing.

Converting to tile-based processing is NOT 100% done, so it may crash on large pastes. Don’t ask me how large since I didn’t try anything more than 300x300 on my machine.

Other TODO’s

Integrate the tool with the help system

Test better the interaction when the the active image/display/drawable are switched during the interaction of the tool.

Get a decent tool icon. Anyone with ideas for the visual metaphor to be used by a seamless paste tool, is more than welcome to leave them here as comments! I do design icons, but I don’t have an idea for this one.

About this blog

This is my blog, dedicated to programming, digital art, and the GIMP project. I'm one of the not-so-active-yet-still-active GIMP developers, and I'm known on the web as LightningIsMyName. I graduated the first degree in computer science this year, and on my free time I like to play with programming.

My main interests are Computer Graphics (both as a digital artist and as a programmer) and photography. My "native" programming language is Java, but I also program in Python, C and Scheme.