03 Lesson 1: Cropping and Rescaling an Image

In this lesson I'll cover cropping and scaling: the important
operations you'll need when you upload some digital camera pictures
and want to put them on the web, or when you download a large image
and want to resize it or only keep part of it.

Let's begin with a common problem. You have an image which you want
to put on a web site to share with your friends. But the image is
three megapixels, half a megabyte of space, and it takes forever for
your friends to download it! Plus it has some elements that could be
improved -- extra space around the subject that doesn't need to be
there, or your thumb in a corner of the frame. :-)

The very first step is to copy your image. You don't want to
overwrite your lovely original image accidentally, so it's usually
safest to make a copy of the image (using cp or your normal file
manager) and edit the copy.

Remember, if you don't have your own images handy, you can download
something from the web to use for experimenting. For a few sources for
raw material, see: http://linuxchix.org/content/courses/gimp/rawmaterial

Once you have your image selected, open it in gimp.
Either run gimp and use the File->Open dialog from the toolbox,
or, from a command line, run: gimp myphoto.jpg


The first tool we'll use is the Crop tool. Its purpose is to let
you pick out a rectangular area of the image which you want to keep,
and discard everything else.

The Crop tool's icon in the toolbox looks like a little knife or
scalpel, and its tooltip when you mouse over it says "Crop or Resize
an image". Click on the knife icon in the toolbox to select the tool.
The button will change to appear "pressed in", but nothing else happens
immediately when you select a tool, until you click in the image.

Now go to the image window, and move the mouse to the upper left
corner of the part of the image you want to keep. Press the left
button down, then drag the mouse (holding the button down) to the
lower right of what you want to keep, and release the button.

Don't worry about getting the boundaries exactly right: you'll be able
to make adjustments.

As soon as you mouse down in the image window, the Crop and Resize
dialog will pop up. Exactly where it appears on the screen is
controlled by your window manager, but most people find that it has an
uncanny knack for being right in the way of the part of the image
you're trying to crop. So once you drag and release, you may have to
move the dialog aside so you can see what you're doing. This is
normal. Swearing a little is also normal. :-)

Once you've moved the dialog aside, you should see a box with
filled-in rectangles each corner. These are the crop tool's "drag
handles": you can adjust the size and position of the box by dragging
these handles around. The upper left and lower right drag handles
adjust the size of the box; the upper right and lower left handles
move the whole box without changing the size. Play with that now.
Don't worry too much if you forget which is which: you can see the
box as you adjust it, so if you drag the wrong handle, just drag it
back to where it was and pick a different one.

Once you've adjusted the boundaries to your satisfaction, it's time
to look at the Crop and Resize dialog. The dialog has three buttons:
Cancel, Resize, and Crop.

The Crop button in the dialog will crop the image, discarding the
rest. Try it now, and see what it does! If you don't like the
result, you can always Undo by selecting Edit->Undo, or by typing
Ctrl-Z. That's an important feature of gimp: Ctrl-Z (or Edit->Undo)
can always undo the last operation, so it's safe to try something
even if you're not sure if it's exactly right. Go ahead and try
that now: press the Crop button, then Undo the crop, then Edit->Redo
to crop it again.

Pressing the Resize button in the crop dialog does something similar
but subtly different: it changes the image size, without changing the
size of the visible layer (we'll talk about layers in an upcoming
lesson). For now, I recommend not using it: use the Crop button
(or Cancel) and ignore the Resize button until later when you're
comfortable using layers. Even then, you may find you don't use
Resize in the crop dialog very often (I never do).

Once you have the image cropped the way you want it, you may want to
Save (Ctrl-S) so you don't lose your work in case of an emergency like
a power failure.

Now I'll talk about making your image smaller for the web, but first,
a quick digression:

Zooming, and Current Image Size

In the GIMP image window, unless your image is very small, GIMP
is probably showing your image smaller than its full size. You
can tell by looking at the image window's titlebar, which shows
the current zoom percentage. If it says 100%, you're seeing your
image as other people would see it. If it says anything else,
then you're not.

In GIMP 2.2, there's a zoom menu in the lower left of the image
window. Everyone else (including 2.2), use the View->Zoom menu
(GIMP 1.2 users, right-click in the image window to see your menus).
But a faster way is to use key bindings: - zooms out (makes the image
smaller), + or =, depending on GIMP version, zooms in; and typing '1'
in the image window will always scale the image to 100%, full size.

You may notice that the window doesn't get bigger and smaller when
you zoom in; it just shows scrollbars or blank space. If you want
the window to change size when you zoom, go back to the toolbox
window, select File->Preferences, click on the Image Windows category,
and check "Resize Window on Zoom". Gimp 1.2 users will have to click
Save for this to be remembered; everyone else, hit OK.


You've cropped your image, but it's still too big to put on the web.
Usually, you want to keep web images under 640 pixels or so in the
largest dimension, because they'll take too long to download, and they
may not fit on most people's screens. Images embedded in a web page
(e.g. thumbnails) need to be much smaller still, maybe only 150-250
pixels. How do you make a big image smaller?

You might be tempted to look for a menu item called "Resize": some
other applications use that term. But in the GIMP, what you need is
to "Scale" the image. ("Resize" means something else, less useful.)

Scale is in the menus, not the toolbox. Right-click on the image
to get a menu (if you're using GIMP 2, you can use the menubar at
the top of the image window) and select Image->Scale Image...
A dialog will appear showing the current size of the image.

The Scale dialog has two sections: Pixel Dimensions, and Print Size.
Don't get confused by these! Pixel Dimensions are the size of the
image in pixels: for example, 640 wide by 480 high for a typical large
web image, or 1600 wide by 1200 high for a 2 megapixel camera image.
Pixel dimensions are almost always what you care about.

(Print Size is a an imaginary number indicating what paper size you
might someday want to use to print the image, if you printed it using
some program other than GIMP. I recommend ignoring it entirely.)

Returning to the Pixel Dimensions section of the Scale dialog:
the dialog shows two pairs of adjustments, for Width and Height,
and Ratio X and Y. GIMP will attempt to keep the image's aspect
ratio -- its ratio of width to height -- constant, unless you tell it
otherwise. So changing only width, or only Y ratio, then hitting tab
or clicking in another field, will change all of the fields in the
Pixel Dimensions section.

Try it now! Try changing the Width to 600, then hitting tab. Or try
scaling the image to half its current size, by changing either Ratio X
or Ratio Y to .5, then hitting tab. If you click on OK you can see
what the size looks like. If you don't like what it looks like,
that's a good excuse to try the ever-useful Edit->Undo menu. :-)

On the rare occasion when you want to change an image's aspect ratio
-- make the picture look shorter and fatter, or taller and thinner --
clicking the small "chain link" icon next to Ratio X and Y (the icon
will change to a broken link) will decouple the width and height, so
that you can change them independantly.

Homework: Take a large image, crop it, and resize it to a reasonable
size for the web.

Next lesson: Image corrections. Lightening, darkening, and sharpening.