You'll come for the HOWTOs, but you'll stay to flame back at my rants!

Gimp Tutorial - Popout Photo

Date/Time Permalink: 07/15/07 08:09:58 am
Category: Graphics Tutorials

Really, this tutorial will be about masking: taking a photograph and separating a foreground subject from the background, for the purposes of doing something interesting with it.

This kind of subject may prove unsatisfying, because when you sit down to write a tutorial, you're free to pick whatever nice clean image you want as your subject. In the real world, clients come to you with fuzzy, blurry, low-res JPGs that have been saved numerous times, with a whole circus of noise in the background. So that's how these masking tutorials make it look so easy: we cheat. If you find this work to be slow, frustrating, and tedious, you're right: masking is just like that, and takes some skill to pull off.

So, for our nice, clean, no-hassle subject image, we'll use this Model-A Ford photo from Wikimedia Commons. From the featured images, yet!

How to mask a subject

1. Generally, the first step is to go Filters-> Colors-> Decompose, and in the dialog check "RGB" and "decompose to layers. You will have a new image with three layers for the channels red, green, and blue. The reason for this is that in noisy photos, the green channel will usually have the best contrast. In some cases with less co-operative pictures, you can combine the channels together in different ways to bring out better contrast.

Popout tutorial 1

2. Copy the channel into a new layer on top of your source image. We'll work with this to get our selection. You can close the channels image. You'll always want to use the magnify tool to blow up the image as much as you can. And select the scissors tool.

Popout tutorial 2

3. Generally, the process is going to be:

  1. Use scissors to find the rough outline of the subject.
  2. Use the lasso select tool in addition mode to include any parts of the subject border and in subtraction mode to cut out parts that aren't part of the subject.
  3. Copy the section from the source to a new layer.
  4. Use the eraser to shave off bits of the background from the image border.

Now, the scissors tool is an inexact, buggy way to select a subject, but we'll be able to correct its mistakes later. To use it, click a series of dots around the subject. Make your dots close together, like this:

scissors detail

The closer you make your dots, the easier time the scissors tool will have finding the border of your subject. In areas where there isn't a nice, clear border contrast, make the dots even closer. Remember that we'll take several more steps to clean this up, so it doesn't have to be exact. But the closer we get it, the less time it will take to clean up. When you've traced dots all the way around the image, click the first dot you laid down and then click inside the image to turn it into a selection.

Here, I've cut away all the not-selected parts to illustrate where we are:

Popout tutorial 3

4. What a lucky shot; with this nice, clean image with a subject that's all straight lines and well-defined curves, we've got it mostly done in one step. Magnify your image some more and start using the lasso selector to either include missing chunks in the selection in addition mode or to cut background off of the selection. Note that you have to start clicking and dragging the selector cursor outside your selection, or else it will think you want to move the selection.

Here, I have stroked the path of our initial selection in red, then drawn a blue box around the part I want to cut off, with a blue X to mark where I start with the lasso selector. Note the pink oval, which is showing the part of the selection options dialog where you change modes between replace, add, subtract, and intersect.

Popout tutorial 4

5. After you have the selection roughly where you need it, copy the original source image layer to a new layer and cut out all the parts not in the layer (Select-> Invert and Ctrl-K, for instance). In this case, I have added a white background and highlighted the next step, which is using the eraser tool to erase around the border and smooth off rough edges. The eraser is using a small fuzzy-circle head, and I'm holding down the shift key to get a straight line along this edge.

eraser detail

Other selection tricks which may work will be: setting the selection options to anti-aliasing, setting them to feather edges, and growing the selection by one pixel, all prior to copying. I have here neglected these steps to illustrate what to do when you have to wipe bits off the border of the selection. No two images will have the same steps.

We now return to the earlier finished selection I did:

Popout tutorial 5

6. Now that you (or, at least, I) have a cleaned-up model separated from the background, the actual work from here is a breeze. First in the layers dialog, let's delete the black and white layer, rename our cut-out subject's layer "Subject", and the white layer "Frame". Move the frame up between the subject and background. Have the eyeballs on for the subject and white frame. And move a horizontal guide out in the image to where you want the edge of the frame to be. Now with the white frame layer active, Select-> All and use the "Perspective Transform" tool to make that white rectangle into a trapezoid which will be the frame's shape.

Popout tutorial 6

7. Turn off the eyeball in the layers dialog next to the Subject, leaving only the Frame layer visible. Use the magic-wand selector tool to select the white trapezoid, then do Select-> Shrink and have it shrink by about 15 pixels. Hit Ctrl-K to delete the new shape inside of the frame shape. Note that you may also want to apply a Guassian Blur of about 2.0 to the frame to eliminate aliased jaggies along the slanted frame edges.

Popout tutorial 7

8. Now use the magic wand selector tool again, to click outside the white frame. With that selection active, in the layers dialog make the background visible, make it the active layer, and in the image hit Crtl-K to cut out everything outside of the frame's border.

Popout tutorial 8

9. Almost there! Make all of the layers visible, and merge them all down on top of each other. Make a new layer with foreground color set to neutral gray and move it to the bottom layer and flatten the image.

I hate to say "Voila!" with such a sloppy job, but here it is, anyway:

finished popout photo

Note that there's a lot we neglected, here. The car's shadow doesn't continue out of the frame. To get that, we would have to make a separate mask for the car's shadow. I blurred the car a bit to smooth out rough edges. I cropped the tires too close when cutting the shadow from them. But to the casual glance, this project is moderately acceptable. I would of course taken much more time had this been a professional assignment.

Of course, I did more work than was necessary for the finished effect - I could have just masked the front half of the car. But actually I masked the whole thing as a project before deciding what to do with it.

Conclusion: masking is an expert-level image hack, and takes much practice. But it is good to have, because professionally you run into it all the time: clients have an old logo they want modified and don't have the source images, or they want a subject moved to a different background, and so on.

17 feedbacks Follow me on Twitter for an update every time this blog gets a post.
Stumble it Digg this Reddit this add to Delicious share on Facebook

Comments:

Comment from: Rea Maor [Visitor] · http://www.AskReaMaor.com
That is WAY cool :)
Comment from: Phantom Gimp [Visitor]
Damn it! Is there anything you can't do with GIMP? ;P

Once again, your expertise with GIMP comes to the fore.
Maybe, if you get enough of these techniques on print, a professional GIMP manual/video could be created. Possibly with other well known contributors maybe?

Anyway, nice one. :)
Comment from: stephanos kalikakis [Visitor]
that is a veeery nice tutorial ...
thank you for sharing ...
Comment from: Roy Schestowitz [Visitor] · http://schestowitz.com
Fun stuff, Mr. Pete. Keep 'em rollin'.
Comment from: Jobin Basani [Visitor] · http://jobinbasani.blogspot.com
Loved it...!
Interesting stuff....
Comment from: Elmer Thomas (thinkingserious on Digg.com) [Visitor] · http://www.notifir.com
Very nice tutorial, I have submitted it to Digg.com.
Comment from: Kristi [Visitor] · http://goodlikeamedicine.com
(Would you be so kind and delete my previous comment please? Thank you!)
This is awesome! Makes me love GIMP even more. Before I try it for some (paid) stuff, I might try making my babies / kids crawling/walking out of the front door or something - haha.

Thanks for sharing!
Comment from: Jakob [Visitor]
The QuickMask feature of Gimp can simplify the process of selecting complicated Objects a lot. You can add stuff to the selection by painting in white (using the pencil for example). Painting in black will remove the painted area from the selection. See the following URL for more information:

http://docs.gimp.org/en/gimp-image-window-qmask-button.html
Comment from: Hayden [Visitor]
This is really neat!
Comment from: healers_charm [Visitor] · http://www.myspace.com/missearthfan
PROBLEM

When i click filter, i don's see the "color" option in the drop down menu.
Why is that?
Comment from: Penguin Pete [Member] · http://www.penguinpetes.com/
@healers_charm

ANSWER: You have the new Gimp 2.4! 2.4 did a big overhaul and re-arranged the menus and added stuff and combined other stuff and all kinds of calamity has ensued.

Explore the menus - it's all still there somewhere. Perhaps the release notes or the Red Hat write-up will be of assistance.

I've grumped about the menu changes, too.
Comment from: gaurav [Visitor]
Thank you!
I am new to Ubuntu and don't know photoshop even though I have it. Did my work in GIMP, was ok, but printing to a specified size is a hassle.
Comment from: image masking services [Visitor] · http://www.sblgraphics.com/photo-masking_service.aspx
I am so very happy to have found you. These tips are going to be so helpful. I can't thank you enough.
Comment from: image masking [Visitor] · http://www.sblgraphics.com/photo-masking_service.aspx
I love the amount of details you gave in your instructions through this tutorial. Great example. Looking forward to more from you.

Regards,
photoshop masking
Comment from: clipping path [Visitor] · http://www.clippingimages.com
The works is really awesome.Love it man.Keep it on. :)
Comment from: Bildbearbeitung [Visitor] · http://www.profimasking.de
Your instruction is quie clear,with reference,I have learned a lot.Thanks.Bildbearbeitung
Comment from: Clipping Path India [Visitor] · http://www.clippingpathindia.com
Great tutorial.But it seems to me that path selection is little bit difficult task.


Your URL will be displayed.
Allowed XHTML tags:
p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, a,
span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite,
abbr, acronym, q, sub, sup, tt, i, b, big, small, pre
Options:
 
(Line breaks become <br />)
(Set cookies for name & url)
images required for CAPTCHA viewing

Alphabet letters and digits 2,3,4,6,7,8,9. The digits 0,1, and 5 are NOT used.

Enter the letters/numbers in the CAPTCHA picture above:
My apology to readers for the hassle. I don't like CAPTCHAs any more
than you do. But we all hate spam even more, and this seems to be an
effective way to stop it.
suddenly the moon