Photo Compositing with The GIMP: Part 1

November 2009

Basing from my previous GIMP article titled Creating Pseudo-3D Imagery with GIMP, you learned how to do some basic selection manipulation, gradient application, faking Depth of Field, etc.  In line with that, I’m following it with a new article very much related to the concepts discussed therein but we’ll raise the bar a bit by having a glimpse on compositing, where we’ll use an existing image or photograph and later add in our 2-dimensional element seamlessly with the said picture.

So if you haven’t read yet “Creating Pseudo-3D Imagery with GIMP”, I highly suggest you do so since almost all major concepts we’ll tackle here are based off of that article.  But if you have an idea on how to do the implied concepts here, then you’re good to go.

If you have been following my advices lately, this might feel cliché to you, but you can’t blame me if I say “Always plan what you have to do!”, right? There you go, another useful and tad overused advice.

Just to give you an overview, this article you are about to spend some time on will teach you basically how to: 1) add 2-dimensional elements to photos or just any other image you wish to, 2) apply effects to better enhance the composition, 3) plan out your scenes well

However, this guide doesn’t teach you how to pick the right color combination nor does it help you how to shoot great photographs, but hopefully though, at the end of your reading, you’ll soon be able to apply the concepts with no hassle and get comfortable with it each time you do.

Some of you might be a bit daunted by the title alone of this article, especially those of you most inclined with specialized compositing software, but as much as I would want to make use of those applications, I’m much more comfortable exploring what GIMP is capable of, not only as a simple drawing application but as a minor compositing app as well.  The concepts that I present here though are just basic representations of what compositing actually is.  And in this context, we’ll only be focusing on still images as reference and output all throughout this article.  If you wanted however to do compositing on series of images, animation, or movie, I highly suggest GIMP’s 3D partner – Blender. Ok, promotion set aside, let’s head back to the topic at hand.

To give you an idea (because I believe [and I’m positive you do too] that pictures speak louder than words), here’s what we should be having by the end of this article, probably not exactly matching it but fairly close enough and I’ll try my best to be as guiding as possible. So let’s hop on!

Photo Compositing with The GIMP

Heart and Sphere Composited with GIMP

Compose, Compose, Compose!

Yup, you read it thrice, I did too, don’t worry.  So what’s the fuss about composing anyway? The answer is pretty straightforward, though. Just like how a song is written through a composition, a photo/image is almost the same thing.  Without the proper composition, your image would never give life.  By composition, I mean a proper mix of colors, framing, lighting, etc.  This is one of the hardest obstacles any artist or photographer might face.  It will either ruin a majestic idea or it will turn your doodle into a wonderful creation you could almost hear the melody of your lines rhythm through your senses (wow, that was almost a mouthful!).

Whichever tool you’re comfortable using, it really doesn’t differ a lot as compared to how you could easily interpret your ideas into something much more fruitful than worrying how to work your way around. That’s probably one reason I stuck into using GIMP, not only am I confident it can deliver anything I could 2-dimensionally think of but more importantly I am comfortable using it, which is a very important thing regarding design in my opinion.

Just like how I wrote this article, composition comes into play (or you might already have doubted me already?).  Without the drafts and planning I made, I don’t believe I could even finish writing a paragraph of this one.

To start off the process, we’ll use one photograph I shot just for this article (in an attempt to recreate the first image I showed you). Or if you don’t want to follow this article thoroughly, you can grab a sample photo from Google Images or from Stock Exchange (, just be sure to credit the owner though or whatever conditions or licenses the image has.

Photo Compositing with The GIMP

Photo to work on

Photo Enhancement

Honestly, the photo we have is already decent enough to work with, but let’s just try making it better so we won’t have to go and adjust it later on.

First, let’s open our image and do some primary color correction to it, just in case you’re the type who thinks “something has got to be better, always”.  Go ahead and fire up our tool of choice (GIMP in this case) and open the image (as you can see below).

Photo Compositing with The GIMP

Opening the image in GIMP


With our photo active in our canvas and the layer it is on (which is the only layer that you see in the Layer Window by default), right click on the image, select Color, then choose Levels. Adjusting the image’s color levels is one good way to fix some color cast problems and to edit the color range of your colors non-destructively (extreme cases excluded), another great tool is using the Curves Tool to manipulate your image the same way that you do with Levels. But again, for the sake of this tutorial, we’ll use the levels tool since it’s much easier and faster to edit.

You can see a screenshot below of the Levels Tool that we’ll be using in awhile.

Photo Compositing with The GIMP

Levels Tool

One nifty tool we can use under our Levels Tool is the Auto function which (you guessed it right again!), automates the color adjustment on our image based on the histogram reading and graph analysis of GIMP. Oftentimes, it makes the task easier for you but it might also ruin your image.  Nothing beats your visual judgment still so if you’re not contented with what the Auto Leveling gives you, go on and move the sliders that you see in the window.  Normally, I only adjust the Value data of the image to correct it’s overall brightness and contrast without altering the overall color mood of the photo.  But if in case you weren’t lucky enough to set your color balance settings on your camera the moment you shot the photo or if you felt the image you’re seeing infront of you is color casted too much, you can freely choose the other color channels (Red, Green, and Blue respectively) from the drop-down menu.

You can see a screenshot below on how I adjusted the photo we currently loaded.

Photo Compositing with The GIMP

Value Level Adjustment


Photo Compositing with The GIMP

RGB Color Level Choices

That’s basically all that we need to do to enhance our photo (or you could go ahead and repeat the process a few more times to get the appropriate feel you wanted).

If you wanted a safer way of editing (just in case you might run out of undo steps), duplicate your base layer that holds your image and work on the duplicate layer instead of the original one, then you can just switch the visibility on and off to see the changes you’ve made so far.

Adding the 2-D Element Above our Photo/Image

You might have already read my previous GIMP article titled “Creating Pseudo-3D Imagery with GIMP”, if not, I really highly suggest you do first before even proceeding on the next steps.  The reason for such is that we’ll use most (if not all) the concepts and techniques we have there in creating the element we’ll add in above our current image.  This time though, instead of just using spheres, we’ll add in just a bit of variation to the shape.  Let’s then make a heart and place it right in the center of the hand, as though the heart is in place.

To do this, make sure first that your photo is the bottom-most part of your Layer Hierarchy, so anything you add in will be on top of it.

Following the steps we did in my previous article, add in those elements on topof our photo and make sure they’re properly organized, just like how you see on the screenshot below:

Photo Compositing with The GIMP
With  2-D Element

After adding in the object to our scene, which right now doesn’t seem as convincing as it looks and doesn’t blend with the photograph that well.  To fix this issue, we must first study how the lighting in the image/photograph is; where the light is coming from, how much it is being lit.  Or you could basically just be guided by the qualities of light – Softness, Intensity, Color, Throw, and Animation. I can’t (though I would very much like to) discuss and elaborate further the implications of the qualities of light for that will take a whole article in itself.

From this point on, I’m assuming that everything you’ll be doing will be fashioned in a layered manner and that you save each and every progress you make as .XCF files (which preserves all the layers, paths, channels, etc.).

Looking over again at the image we have above, it seems like the heart is just there floating in space, creating no connection whatsoever with our photograph, making it look too fake (which we are trying very hard to avoid).  To address this, let’s take a closer look at where the light actually hits the objects in the scene, and naturally when there’s light there’s shadow.

First step that we have to do is to add some shadows to our scene, just to tell our audience and viewers that this heart we have here is actually rested on the hand and not afloat elsewhere.  Since I took this photograph inside a room with light penetrating through the windows,the softness of the shadow edges will be greater as compared to a subject cast with direct illumination like that of an object lit directly under a study lamp or under a sunny afternoon.  This entirely depends on the light settings of your scene.  Looking over to the photograph once again, I was guided by the current shadows that the photograph has so what I only have to do is to try to emulate that quality of shadow that we see on the photograph as close as possible.

Let’s go ahead and add a new layer on top of our original photograph and below our heart layer.  Rename it to something descriptive, I named mine“heart distorted shadow”.  This will be the layer which will define the shape of the shadow as it is casted on the irregular elevation of the palm.  To create the selection, go over to the Toolbox Menu and select the Paths Tool or the Free Select Tool (if you’re talented enough to draw those fine selections) then go ahead and create the selection, following how the palm’s elevation is (as seen in the screenshot below).

Photo Compositing with The GIMP
Creating the First Shadow

After this, we can’t just go right in and fill our current selection with some color (like what some of you might have thought).  We need to create a feathered selection or a blurred selection out of the current one we have so when we fill it up with a color, there’d be a smooth falloff.  This can however be achieved by just filling in the current selection we have (before applying the feathering) then later on blurring that layer. Each of which leads us to the same results.

To feather or blur the selection, right click on the Image Window, choose Select, then click Feather (see screenshot below).

Photo Compositing with The GIMP
Feathering the Selection

Right after doing this, a pop-up window will appear enabling you to set the amount of feathering/blurring on your selection.  This is subjective to the size of your selection.  As in my case, I chose 50 pixels as the amount of feathering.  I could have tried 100 pixels but that could have been too much and we only need an ample amount to simulate the soft shadowing present on our image, just like how you see in the highlight/shadow casts on the upper right hand side of the photograph.

Photo Compositing with The GIMP
Feathering Amount

You’ll notice our current selection changed shape, don’t worry that’s a natural thing that happens.  I wish there could be a way for us to visualize the feathering present in a selection though (but well, we’re good enough knowing that instead).

Now that we have applied our selection blurring, it’s time to fill it up with some nice color to play around with (finally!).  Let’s choose a shadow tone that would somehow match the shadow colors that’s in our scene, as in my case a dark orange one.  Then go ahead and fill it up! An easy way to do this of course is with the Paint Bucket tool (which I prefer most of the time).  But you could use the Gradient Tool or you could go crazy and use a soft brush to paint it over.

If you’re lucky enough (I wasn’t), you could leave it just at the current opacity/transparency it is now, but if not, you could drag the opacity slider down to a reasonable value.

Photo Compositing with The GIMP
Filling the Feathered Selection with Color

Repeating the same process we can create really nice looking shadows underneath the heart, this time though they’ll be a bit sharper and darker than the shadow we previously made.  This is to simulate an occlusion effect we see everyday and everywhere.  These are the shadows and the dark shades that wee see in between objects that typically define how close they are and it’s a visual feature of reality and CG to better tell us that “something is on something”.  You could typically do a test by placing a pencil on your desk and you’ll notice those dark tiny shadows that you see underneath the pencil and on the table, just a little away where they intersect and touch each other. Oftentimes, it’s more of a subconscious effect more than a plain one, but it indeed helps to add believability to your scenes.

Again, I’m going safe here so I’ll place each shadow I like in a separate just so I could disable and enable them anytime I want to without affecting the whole set of shadows I have (as you’ll see in the screenshot below of my layers window).

Photo Compositing with The GIMP
With Occlusion Shadows Added

As of the current state of our image, it’s almost done.

>> Continue Reading Photo Compositing with The GIMP: Part 2

You've been reading an excerpt of:

Blender 3D 2.49 Incredible Machines

Explore Title