Photo Manipulation with GIMP 2.6

Exclusive offer: get 50% off this eBook here
GIMP 2.6 cookbook

GIMP 2.6 cookbook — Save 50%

Over 50 recipes to produce amazing graphics with the GIMP

$26.99    $13.50
by Juan Manuel Ferreyra | March 2011 | Cookbooks Open Source Web Graphics & Video

This article starts with an explanation of the basic image editing tools. After that, there are a few advanced techniques to create high-quality effects with any kind of photo.

In this article by Juan Manuel Ferreyra, author of GIMP 2.6 Cookbook, we will cover:

  • Scaling and Cropping an image
  • Flipping or rotating an image
  • Improve low-light photos
  • Scaling an image without deformation (Liquid Rescaling)
  • Creating a diorama effect (simulating depth of field)
  • Creating HDR photos
  • Creating a black and white postcard with a color touch

 

GIMP 2.6 cookbook

GIMP 2.6 cookbook

Over 50 recipes to produce amazing graphics with the GIMP

        Read more about this book      

(For more resources on GIMP, see here.)

Introduction

When working with photos we need to be sure that colors always look the way we want. Monitors, LCDs, and laptop screens, all render colors differently, and they don't look the same. There's no way you can control how people see their own screen, but you can calibrate your own using some kind of color profiling. The problem extends to different devices like scanners, printers, and cellphones, among others, because each device has its own color characteristics. Also, each device can handle different ranges of color.

To avoid these problems, color profiles were implemented. It's a table that matches a specific color of a device to a device-independent color. Color profiles are created by each manufacturer, but the ICC (International Color Consortium) created its own standard.

Calibration, image modes, and colour profiles

This is one of the first things to do before working with photos. The Color Management menu (Edit | Preferences | Color Management) enables you to load any preset for your monitor. The presets can be created using any hardware calibration and measurement tool. For Linux, you can use LPROF and ARGYLL. For more information on color management in Linux, check the Linux color management page on Wikipedia.

Apart from the color profile in use, you should set up your monitor and video card to render colors as close as possible to the standard. For Linux you can use XCALIB or DISPWIN.

You can also simulate how an image will look when printed by selecting Print Simulation from the Mode of Operation in the Color Management menu.

Scaling an image

Image scaling is one of the easiest tasks, and also one of the most useful. In just a few seconds you can reduce an image's size, making e-mail transfers quicker.

How to do it...

To scale an image follow these steps:

  1. Open a file, go to Image | Scale Image.

  2. Change the size to whatever you want:

    Tutorial on Photo Manipulation with GIMP 2.6

    As you change one value, you can see the other changing too. That's to keep the original file aspect ratio. If you click on any of the chain icons you can change any value independently.

How it works...

Image scaling works by changing the number of pixels of an image. The way pixels are created/deleted can be changed by choosing a different interpolation method in the Quality section of the Scale Image window. The best (but slowest) method is the Cubic interpolation, which calculates the color of each pixel by estimating an average of the eight closest ones. On the opposite corner, if you choose None as the interpolation method, each pixel gets its own color from its closest neighbor. This is the fastest method, but it also generates unwanted aliasing that can give you headaches if you are working with transparencies and highcontrasts.

The resolution fields are useful when printing the image, they say how many pixels are per inch. If your image is too big and the resolution too low, the printed image can look pixelated. You can change the print size of an image without changing its resolution or size by going to Image | Print Size.

Cropping an image

There's another quick way to rescale your image and select just a section of it. Use the Crop Tool.

How to do it...

The following steps will show you how to crop an existing image:

  1. Open an image, and select the Crop Tool:

  2. Quickly click and drag around the area you want. Then, just press Return (Enter in Windows), and anything around the selection area will be cropped.

Flipping or rotating an image

Sometimes you scan and old photo or take a picture with the camera tilted. Following is how to quickly rotate or flip them.

How to do it...

To rotate or flip an image easily, carry out the following steps:

  1. Open an image, for example the following:

  2. Select the Flip Tool from the Toolbox:

    Tutorial on Photo Manipulation with GIMP 2.6

    Use the left-mouse button along with the Ctrl key to change between horizontal and vertical flipping.

  3. Now, to rotate the image, select the Rotate Tool from the Toolbox:

    Tutorial on Photo Manipulation with GIMP 2.6

    Click and drag your image to rotate it. Use the Ctrl key to constrain rotation to 15 degrees steps. Press the Return key when you've finished:

How it works...

Flip and rotate are basic tools. You can use the mouse to perform the operations after selecting any of them, but using their respective tool options gives you a lot more control. In both cases, you can control what to rotate (a layer, a selection, or a path).

Also, in the Rotate tool, you can change the middle point around which the image rotates. This allows you to rotate the image with more freedom. To change it, select the Rotate Tool, and click and drag the small circle that appears in the center of the image:

You can also set its coordinates from the Rotate window:

Tutorial on Photo Manipulation with GIMP 2.6

You can also flip and rotate an image by using the menu items in Image | transform.

GIMP 2.6 cookbook Over 50 recipes to produce amazing graphics with the GIMP
Published: March 2011
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:
        Read more about this book      

(For more resources on GIMP, see here.)

Improving low-light photos

Sometimes, we take photos too quickly, and they end up being too dark. There are ways to correct this problem but keep in mind we are dealing with random pictures. Sometimes, we might end up with a grainy photo with washed colors or without contrast. So follow the upcoming steps as a guide, and experiment with different settings until you are satisfied. Sometimes, you can fix your image by changing just the brightness and contrast, sometimes, you have to combine the steps, and sometimes, repeat them.

How to do it...

To improve or brighten low-light images, carry out the following steps (you are free to experiment with the values). Open a dull/dark image that requires brightening, for example the following:

There are three methods by which we can improve the image:

  1. Method 1: This is the most basic, quick, and easy way to try to make your low-light photo look better. Go to Colors | Brightness-Contrast, and move the sliders to change the brightness and contrast levels for the active layer or selection:

    Tutorial on Photo Manipulation with GIMP 2.6

    You can also keep your left mouse button clicked and drag horizontally to change contrast, and vertically to change brightness. The final image looks like the following:

  2. Method 2: Changing levels is a bit more complex, but once you know a few things, using it is pretty intuitive.

     

    Go to Colors | Levels, and the Adjust Color Levels window appears. By clicking and dragging inside each of the three little triangles at the bottom of the Input Levels area, you can change the values for dark, middle, and light levels of your layer or active selection. These values range from 0 (black) to 255 (white) and allows you to change how the image looks depending on how each pixel falls in any of these three "categories":

    Tutorial on Photo Manipulation with GIMP 2.6

    This is how the image looks after applying the changes:

  3. Method 3: Changing curves instead of levels or brightness-contrast is the best way to make your image look better. Since with curves, we have better control over how contrast and brightness are distributed by adding as many control points as you want. Go to Colors | Curves to get to the Adjust Color Curves window:

    Tutorial on Photo Manipulation with GIMP 2.6

    The vertical gradient represents the image's pixel level you want to set (the output tonal scale). The horizontal gradient represents the level of each selected pixel (the input tonal scale); both of them ranging from 0(black) to 255(white), shadows to highlights.

    There are two anchors, each on an extreme of the graph. If you click on them, or when you click on the curve (and a new anchor is created) you can move it around the axes with the mouse or the up and down arrow keys if you want more precision.

    Tutorial on Photo Manipulation with GIMP 2.6

    This is the image after applying the changes:

As you can see, playing a bit too much with curves can introduce color aberrations, so you have to keep experimenting until you get to the colors and definition you want.

Scaling an image without deformation (Liquid Rescaling)

Image scaling is easy when you want to just change the size of an image. However, many times you want to change size of just a few objects, or adjust the background size. These tasks can be painful and time-consuming. However, since a few years ago there have been some techniques available that allow the automation of these tasks. There is a plugin that implements one of these algorithms (called Seam Carving).

Getting ready

To use this plugin, you will have to install it first. The process is different depending on the platform you are working on, but it's pretty straightforward and easy. All the information to download and install it is on the Liquid Rescale Wikipage. You can confirm it's properly installed if you see a Liquid Rescale... option at the bottom of your Layer menu.

How to do it...

Time to have fun with the liquid rescale:

  1. Open an image you want to rescale. For example, the following:

  2. Go to Layer | Liquid Rescale...

  3. The plugin can take more than a moment if you are using big images. So, it's a good way to start by copying the original file, opening it, and reducing it's size. Once you are satisfied with the results, you can open the original and apply the plugin with the same settings.

  4. Now it's fun and test time! Try these options first:

  5. Click on the New button in the Preserve features section on the right. A new layer will be created:

    Tutorial on Photo Manipulation with GIMP 2.6

  6. Now, move the plugin window, don't close it! Go back to the image window and combine the Selection Tools, the Path Tool, and the Paintbrush Tool with the Paint Tool, and paint over the areas you wish to preserve when scaling:

  7. Back in the plugin window, click the Refresh button at the bottom to see the preservation mask applied. Click on the Output tab, and copy my settings:

  8. Click OK. You should get the following result:

  9. Hide the Background LqR seam map layer to check the filter result. Go to File | Save or File | Save as..., or any of the save options from the File menu to save your changes.

How it works...

What you've just done is to paint around the areas that the plugin preserves when it is applied. You are helping it decide what NOT to scale. In this case, I decided to shrink the image's width, and by painting the cats in the layer that the plugin creates, I told it to use the surrounding pixels to modify the image.

The preservation mask is optional, but when practicing you will realize that many times, without it, the plugin can create undesired distortions.

The Background LqR seam map layer created in the example is optional; don't click in the Output the seams box in the Output tab of the plugin window. I used it in my example to show you how the plugin doesn't cross the area you marked as preserved unless it is too big, and there's nothing else to modify when scaling.

There's more...

This is a very useful and time-saving plugin when you get the hang of it. Check the Liquid Rescale Wikipage for any updates, manual, and tutorials

Creating a diorama effect (simulating depth of field)

A diorama is a miniature model; it can be a fictional or a real place. Here, you will learn to make your pictures look like small landscapes with tiny little people or objects moving around.

How to do it...

Carry out the following steps to give your picture a diorama effect:

  1. Open an image file (a nice wide landscape with people, cars, and so on would be apt). For example, the following image:

  2. Pick a focus point; it should be anything near the ground level. Using the Ellipse Select Tool, draw a selection around it. For my example, we choose the people around the center of the image enjoying the day, sitting on the grass:

Invert your selection by going to Select | Invert. Now, go to Select | Feather, and enter a value between 200 and 400. I made a few tests, and a feather of 300 pixels works for my example.

Tutorial on Photo Manipulation with GIMP 2.6

  1. Now, go to Filters | Gaussian Blur and enter anything between 5 and 7 pixels for both the X and Y values.

  2. Clear your selection by going to Select | None. Go to Colors | Hue-Saturation,and increase the saturation level to anything you like. The following are the settings I used:

    Tutorial on Photo Manipulation with GIMP 2.6

  3. Following is what the modified image looks like:

How it works...

As the effect simulates a photo taken of a little model instead of a real life landscape, we need to fake the depth of the field of the lens. Depth of field is how far away the eye (or a camera lens) can remain in focus. In a small model, the depth of field can be very small; that's why we pick a focus point, and start selectively blurring around it, increasing the amount of blur for the objects that are further from it.

Coloring also is different for small objects and wide, far-away landscapes. Since small objects are usually lit with artificial lights or camera flashes, color can be more vivid or bright, so we need to simulate them too.

GIMP 2.6 cookbook Over 50 recipes to produce amazing graphics with the GIMP
Published: March 2011
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:
        Read more about this book      

(For more resources on GIMP, see here.)

Creating HDR photos

HDR stands for High Dynamic Range. HDR techniques allow the creation of images with a wider range of luminance between the darkest and brightest areas of a single photo. This means pictures are a bit surreal and great looking!

How to do it...

For this technique you need to take three photos of the same target, one underexposed, one correctly exposed, and one overexposed.

Most modern cameras already come with a setting to do this. Check your camera manual for the "multiple exposure button" and the "AEB—Automatic Exposure Bracketing" options. If you are not sure how this works, just take three pictures:
Normal: Just take the picture!
Underexpose: Use a shorter exposure time or close the aperture.
Overexpose: Use a longer exposure time or open the aperture.
Unless you want to have aberrations or artifacts in the final piece, always use a tripod!

These are the pictures with which I'm going to be working:

  • Following is the underexposed picture:

    Tutorial on Photo Manipulation with GIMP 2.6

  • Following is the well-exposed picture:

    Tutorial on Photo Manipulation with GIMP 2.6

  • Following is the overexposed picture:

    Tutorial on Photo Manipulation with GIMP 2.6

  1. Open your files, go to File | Open as Layer, and select your three photos. Hit Return or click the Open button. Your files will be loaded each one into it's own layer:

    Tutorial on Photo Manipulation with GIMP 2.6

  2. Reorder the layer with the normal picture at the bottom, the underexposed one in the middle and the overexposed picture on top of them. Rename the layers to avoid confusion:

    Tutorial on Photo Manipulation with GIMP 2.6

  3. Make the overexposed layer invisible by clicking on its eye icon.
  4. Select and duplicate the underexposed layer, and go to Layer | Duplicate Layer. Select the underexposed copy layer, and go to Colors | Desaturate to make it black and white. Click OK.

    Tutorial on Photo Manipulation with GIMP 2.6

  5. If the image is mostly black and white like in my example, go to Colors | Curves and drag the diagonal's middle point upwards to get a brighter picture. Now, click OK:

    Tutorial on Photo Manipulation with GIMP 2.6

    This is essential for the effect to work. Experiment with this setting, and try to make things appear if it's too dark:

    Tutorial on Photo Manipulation with GIMP 2.6

  6. With the underexposed copy layer still selected, go to Select | All and press Ctrl + C, or go to Edit | Copy. Make this layer invisible by clicking the eye next to it in the Layers dialog. Click on the underexposed layer to select it. Right-click on it, and select Add Layer Mask...:

    Tutorial on Photo Manipulation with GIMP 2.6

    Click Add on the window that appears:

    Tutorial on Photo Manipulation with GIMP 2.6

  7. With the new mask selected, press Ctrl + V or go to Edit | Paste to paste the desaturated layer into the mask. Click the anchor button:

    Tutorial on Photo Manipulation with GIMP 2.6

    You should see now that the darkest areas of the underexposed picture are shown, while all the bright parts are masked. Click the eye button of the underexposed layer to see the difference:

    Tutorial on Photo Manipulation with GIMP 2.6

  8. These steps are almost the same as for the overexposed layer. Select and duplicate the overexposed layer. Select the overexposed copy layer, and make it black and white:

    Tutorial on Photo Manipulation with GIMP 2.6

  9. Invert colors so we can use it as a mask. Go to Colors | Invert:

    Tutorial on Photo Manipulation with GIMP 2.6

  10. If again, the image is mostly black and white like in my example, go to Colors | Curves, and drag the diagonal's middle point upwards to get a brighter and picture:

    Tutorial on Photo Manipulation with GIMP 2.6

    Remember, experiment here! I got the following image:

    Tutorial on Photo Manipulation with GIMP 2.6

  11. With the overexposed copy layer still selected, go to Select | All, and press Ctrl + C. Make this layer invisible by clicking the eye next to it in the Layers dialog. Select the overexposed layer. Right-click on it, and select Add Layer Mask...:

    Tutorial on Photo Manipulation with GIMP 2.6

    Click Add on the window that appears:

    Tutorial on Photo Manipulation with GIMP 2.6

  12. With the new mask selected, press Ctrl + V to paste the desaturated layer into the mask, and click the anchor button:

    Tutorial on Photo Manipulation with GIMP 2.6

  13. You should see now that the brightest areas of the overexposed picture are shown, while all the dark parts are masked; through them you can see the dark areas of the underexposed and behind it, the normal layer.

    Here's the final piece:

    Tutorial on Photo Manipulation with GIMP 2.6

How it works...

The idea in HDR photography is to take different shots of the same picture and normally expose the different shades, so that shadows, bright areas and normally lit areas appear correctly exposed in each shot. What we've done here is to use masks to make specific parts of the image transparent to allow the proper part (the well-exposed areas in each photo) to be displayed.

The key to the whole process is to take at least three photos, exposed normally, one stop underexposed, and one stop overexposed. Use a timer to avoid moving the camera when taking the photos. It's not impossible to do this with slightly different angles or compositions, but first try to use a tripod.

Creating a black and white postcard with a color touch

This is a quick way to create a nice postcard from a picture, turning it to black and white with a twist of color in it.

How to do it...

Keeping in mind that we are going to use it as a postcard; take a new picture, or search for one that you like. I'll be using the following photograph:

Tutorial on Photo Manipulation with GIMP 2.6

  1. First, duplicate the layer by going to Layer | Duplicate Layer. Click on the eye icon next to the background copy button to make it invisible. Click on the background layer to select it.
  2. The final piece will be grayscale, with a little touch of color. So, first choose the object that will remain in color. For my example, I choose the flower. Go to Colors | Brightness-Contrast, and adjust the saturation until you are satisfied with the level of the object you choose to remain in color. The following are the settings I used:

    Tutorial on Photo Manipulation with GIMP 2.6

    Following is how the picture looks after applying the effect:

    Tutorial on Photo Manipulation with GIMP 2.6

  3. Re-enable the background copy layer by clicking on the white rectangle next to it:

    Tutorial on Photo Manipulation with GIMP 2.6

  4. Click on the background copy layer to select it. Go to Colors | Desaturate to turn the layer to grayscale. Click OK:

    Tutorial on Photo Manipulation with GIMP 2.6

  5. If you want, you could adjust levels or curves of the black and white layer.

  6. Right-click on the layer name, and select Add Alpha Channel:

    Tutorial on Photo Manipulation with GIMP 2.6

  7. With the background copy layer still selected, use the Eraser Tool over the areas where you want to expose colors:

    Tutorial on Photo Manipulation with GIMP 2.6

  8. Use the Zoom Tool along with the brush type and scale slider of the Eraser Tools options to work with better accuracy.

    If you have solid colors, you can try quickly selecting it with the Fuzzy Select Tool use it's threshold slider to also select contiguous colors.

    Tutorial on Photo Manipulation with GIMP 2.6

    Continue working until you expose all the areas you want.

    The Eraser Tool works differently when applied to a layer without an alpha channel or with it. If the layer doesn't have an alpha channel, the Eraser Tool removes areas of colors and replaces it with the current background color. On the other hand, if the layer has an alpha channel, the tool removes areas of colors, turning them transparent. This is why we need to add an alpha channel to our desaturated layer.

  9. You could also delete any part you want of the black and white layer, and apply any kind of other color-correction technique to the original layer, by going to Colors | Hue-Saturation and adjusting the Hue and Lightness sliders to change the color of the object completely:

    Tutorial on Photo Manipulation with GIMP 2.6

    This is how the final piece looks:

    Tutorial on Photo Manipulation with GIMP 2.6


Further resources on this subject:


About the Author :


Juan Manuel Ferreyra

Juan Manuel Ferreyra is an illustrator and animator from Buenos Aires, Argentina. He is 34 and lives with his cat. Although he started drawing at a young age, computers caught all his attention, and he worked in the IT world for many years. He dropped out from Computer Engineering and started studying filmmaking, working on his own projects and as a freelance illustrator in his free time. After a few years, he decided to leave the IT world and started working as a full time freelance illustrator and animator; his website is http://www.omykron.com.ar. The cat is happy.

Books From Packt


XNA 4.0 Game Development by Example: Beginner's Guide
XNA 4.0 Game Development by Example: Beginner's Guide

Unity 3D Game Development by Example Beginner's Guide
Unity 3D Game Development by Example Beginner's Guide

SketchUp 7.1 for Architectural Visualization: Beginner's Guide
SketchUp 7.1 for Architectural Visualization: Beginner's Guide

Panda3D 1.7 Game Developer's Cookbook
Panda3D 1.7 Game Developer's Cookbook

OGRE 3D 1.7 Beginner's Guide
OGRE 3D 1.7 Beginner's Guide

Facebook Graph API Development with Flash
Facebook Graph API Development with Flash

Flash Game Development by Example
Flash Game Development by Example

Away3D 3.6 Cookbook
Away3D 3.6 Cookbook


No votes yet

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
r
8
r
S
4
L
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software