Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 76 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
76
Dung lượng
1,44 MB
Nội dung
Part III: Manipulating Images text and you want to give that text an outline. The easiest way to do this would be to make a selection using your text layer’s alpha channel (Layer Transparency Alpha to Selection) and then paint along that selection with the Stroke Selection operation (Edit Stroke Selection). A problem arises, however, if these are the only two steps you use. For some fonts there’s not a lot of space around your text in its text layer, so when you stroke the selection, it’s likely that you’ll get something that looks like the text in Figure 8-3. Notice how the outer portion of the outline is cropped off by the boundaries of the text layer. FIGURE 8-3 When you create an outline on some text layers, your outline may be constrained by the bound- aries of your layer. You could get around this by creating a new transparent layer (Shift+Ctrl+N) and adding the stroke there, but if you ever decide to edit that text, you would have to delete and replace that layer. However, as explained in Chapter 10, text layers in GIMP are still editable even if you paint on them or perform other operations on them. Of course, editing removes all of those addi- tional operations, but the benefit is that you don’t end up with superfluous layers that you have to delete. So to resolve that cropped outline problem, you need to increase the size of the text layer to accommodate the extra space that the outline requires You could do this manually with the dialog that appears when you run Layer Layer Boundary Size, but that’s a bit slow and it involves some guesswork on your part to make sure you create enough space. A faster way is to run Layer Layer to Image Size. As long as your text isn’t close to the edge of your canvas, this should quickly give you enough space to get a non-cropped outline, as shown in Figure 8-4. FIGURE 8-4 Text without the cropping problems shown in Figure 8-3 Cropping and Guillotine The previous section showed how the Image and Layer menus offer you operations to increase the size of an image canvas or a layer to predefined values. It makes sense that these menus would also provide you with a way to do the reverse: cropping your image or layer in an auto- mated way. You can perform four operations: Crop to Selection, Autocrop, Zealous Crop, and Guillotine. All of these functions are available in the Image menu, but only the first two appear in the Layer menu. Warning Even though these operations are in the Image menu and they affect all of the layers in your image, you should know that GIMP uses the current active layer as its starting point when it runs these operations. I go 190 Chapter 8: Transforming Images into more detail later in this section, but as an example, if you use the Autocrop Image operation and your active layer has content that’s smaller than other layers, GIMP crops the image to fit that layer’s content rather than cropping to fit all of the visible content in the image. There’s a way around this and I go into it in the next section. Crop to Selection As explained in Chapter 4, GIMP has a very powerful Crop tool (Shift+C). However, in some instances it’s not the fastest or most ideal tool for the job. As an example, say you’re working on a photograph of a group of people and you’ve gone through the effort of using the Free Select tool and the Quick Mask to select a single person from that group to tweak some colors. If you want to crop the image and isolate that person, you could switch to the Crop tool, but it’s much faster to use either Image Crop to Selection or Layer Crop to Selection. This way you don’t have to spend time with the Crop tool trying to get it to fit your selection. The Crop to Selection operation is particularly useful when you have softer selections. For instance, say you’ve feathered a selection (Select Feather) or used the Quick Mask with a soft-edged brush or a brush at less than 100% opacity. In these cases, the marching ants that show your selection may not fully encompass all of the pixels that have been selected. That makes it a lot harder to estimate visually what’s been selected if you’re just using the Crop tool. Figure 8-5 shows the Crop to Selection function in action. FIGURE 8-5 Using Crop to Selection to crop an image based on a selection you’ve already made (Photo credit: Melody Smith) Original Selection mask Crop to Selection Autocrop Crop to Selection is a really handy feature, but GIMP offers some other more automated ways to crop images. One of the handiest tools for this is the Autocrop feature. Basically, what Autocrop does is remove empty space from an image or a layer. To understand this, the simplest 191 Part III: Manipulating Images example is to imagine an image with a gray background and a black circle somewhere in the middle of that space. If you Autocrop that image, all extraneous gray is cropped away, leaving you with only an image of your black circle, as shown in Figure 8-6. The cool thing is that GIMP’s Autocrop doesn’t just work on colored pixels. It also accounts for pixels that are made transparent, whether by erasing or using a layer mask. For an automated tool, you get a lot of flexibility out of it. FIGURE 8-6 Using Autocrop to clear away empty space Original image Autocropped image You can use Autocrop from either the Image menu or the Layer menu by going to Image Autocrop Image or Layer Autocrop Layer, respectively. A very important thing to note here is that even if you’re calling Autocrop from the Image menu, GIMP uses the current active layer to determine which pixels count as empty space. To illustrate this, say you took the circle in Figure 8-6 and added a new layer to turn it into a cartoon cat like the one in Figure 8-7. The space covered in the new layer to create the eyes, whiskers, and ears is larger than the circle in some parts and smaller in others. You may expect that if you run Image Autocrop Image the result would be your full cartoon cat on a smaller gray background. However, this is not what happens. If the original circle layer is active, Autocrop chops off a lot of your additions. If your new ‘‘cat bits’’ layer is active, part of your original circle is cropped. FIGURE 8-7 Autocropping an image still uses the active layer to determine what pixels to crop off. Original image Autocrop to new layer Autocrop to original layer New layer 192 Chapter 8: Transforming Images You have four possible solutions to deal with this situation: Merge visible layers — The easiest one is to simply merge your layers by right-clicking in the Layers dialog and selecting Merge Visible Layers, or from the image window go to Image Merge Visible Layers. Because this leaves you with just one layer, the Autocrop Image operation works as desired. The disadvantage to taking this route, however, is that it destroys your layer structure and makes it more difficult to edit your image in the future. Create a temporary layer from visible elements — Another solution is to use the Layer New from Visible feature. This creates a new layer based on the visible elements in your image. Once you do this, select the new layer and run the Autocrop Image operation on it. After that, you can delete this extra layer from the Layers dialog. This method is fast and it preserves your layer structure, but it does require you to go through the somewhat annoying step of creating a temporary layer. Use a group layer — GIMP 2.8 introduced the very slick feature of group layers. As explained in Chapter 6, a group layer is a special layer that encompasses multiple layers within it. To create a new group layer, click the Group Layer button in the Layers dialog. With the group layer created, you can drag each of your element layers (the circle and the cat bits) into the group layer. Once you’ve done that, select the group layer and run the Autocrop Image operation on it. With this method you get to keep your layer structure and you don’t have to create any temporary layers. Use the Crop tool with Auto Shrink and Shrink Merged enabled — This is discussed later in this chapter in the ‘‘Crop Tool’’ section. Tip The Autocrop feature is implemented in GIMP as a plug-in. A side effect of this is that it’s counted as a filter operation. Though this may seem a bit odd, the benefit is that it’s actually really easy to quickly re-run the operation by going to Filters Repeat ‘‘Autocrop Image’’ or using the Ctrl+F keyboard shortcut. Zealous Crop The Zealous Crop feature is similar to Autocrop, but it takes an additional step. Whereas Autocrop crops only from the borders of your image, Zealous Crop also deals with empty space between elements in your image. As an example, take the cartoon cat head from Figure 8-7 and say you’ve added a rectangular section at the bottom of the image for the cat head to rest upon, as shown in Figure 8-8. You could go through the laborious process of visually lining up the block and the head. However, this is where Zealous Crop can simplify things for you. Just run Image Zealous Crop and GIMP automatically removes the empty space around and between the cat head and the block at the bottom of the image. Take note that, as opposed to Autocrop and Crop to Selection, the Zealous Crop feature is avail- able only in the Image menu, so you can’t really Zealous Crop an individual layer. That said, Zealous Crop still has the limitation of Autocrop in that it uses only your current active layer to calculate where the empty space is. This means that if you have a multi-layer image that you want to use Zealous Crop on, you should merge layers before performing this operation. The other two techniques that you can use with Autocrop don’t work as desired with Zealous Crop. 193 Part III: Manipulating Images This is because Zealous Crop doesn’t currently move elements in other layers (including layers that have been grouped). It would be nice if in the future Zealous Crop takes advantage of group layers, but it currently doesn’t work that way. FIGURE 8-8 Using Zealous Crop to remove empty space between elements. Original image After Zealous Crop Guillotine The last automated cropping tool in GIMP is the Guillotine function. Guillotine uses the guides in your image window to slice your image into component parts. This is an extremely useful tool if you’re doing web or interface design. As an example, take a look at Figure 8-9. This is a sim- ple mock-up for some company’s web site. Guides have already been placed where the designer wants to slice the image. To perform the actual slicing operation, simply run Image Transform Guillotine. When you do so, GIMP goes through the image, moving from the top left to the bottom right, and creates a new image window for each block outlined by the grid. From there, you can go into each image window, make any changes you feel are necessary, and export to whatever image format you want. The really cool thing about Guillotine is that it actually maintains your layer structure for the visible elements in each sliced component. For example, the central content block of the design in Figure 8-9 has a bunch of filler text. Obviously that’s not something you’d really want to include in the final design, and because GIMP doesn’t flatten the image when it performs the Guillotine, you can just hide the filler text layer in the image slice that it created. Tip If you’re working on a design like the one in this example that features empty space around the actual design, it’s probably a good idea to Autocrop the image prior to running Guillotine. This way GIMP won’t create a bunch of superfluous slices of solid color that you’ll ultimately end up getting rid of anyway. 194 Chapter 8: Transforming Images FIGURE 8-9 You can use the Guillotine operation to slice this web site design into its component parts. Flipping and Rotating So far, with the possible exception of Zealous Crop, this chapter has covered only features that involve increasing or decreasing the boundaries of a layer or an image canvas. Of course, trans- forming pixels involves a lot more than that. Two critical transform operations that any serious image editing application requires are flip and rotate. GIMP offers convenient menu items to per- form either of these functions quickly for the entire image or for individual layers. To access the flip or rotation menu items, look in the Transform submenu of either the Image or the Layer menu, as shown in Figure 8-10. Flipping The ability to flip an image quickly is a surprisingly underutilized feature by people who are new to digital image editing. Flipping is particularly useful for digital painters. It’s a common practice for traditional artists to turn their work upside down or look at it in the mirror as a means of testing their composition. Doing this tricks your brain into looking at the shapes and colors of your composition rather than the content of the image. The digital equivalent to this is quickly flipping your image horizontally or vertically, or both. As a matter of fact, I use flipping often 195 Part III: Manipulating Images enough when I’m working that I created custom keyboard shortcuts so I can perform this action quickly in the middle of painting. If you look at Figure 8-10, you can see that I set these short- cuts to Ctrl+Alt+F for flipping an image horizontally and Shift+Alt+F for flipping the image vertically. You can also flip individual layers from the Layer Transform submenu. FIGURE 8-10 You can find flipping and rotating controls for the whole image or individual layers in the Trans- form submenu. Another common use for flipping is to create a symmetrical image. To do something like this, you work on one half of your image, getting it to look exactly the way you want. Once you fin- ish, duplicate the layer you’re working on, flip it horizontally, and move it to the opposite side. After that, run Image Fit Canvas to Layers to see your finished work. This is useful if your are painting portraits, editing photographs of architecture, or, as shown in Figure 8-11, draw- ing gears. Rotating The ability to rotate an image or layer is a feature that’s available for nearly every application used to edit images. In fact, most image viewers even have some rudimentary form of rotation. As shown back in Figure 8-10, the Transform submenu of both the Image and Layer menus allows you to do basic rotations in 90 ◦ increments as well as a full 180 ◦ rotation. If you want to rotate the entire image, including all layers, choose the rotation angle you want from the Image Transform submenu. This is particularly useful if you get a photograph from an older digital camera that doesn’t store rotation information. So if you get an image that’s sideways, this is the quickest way to fix it. However, if you want to rotate only one layer, you need to select that layer and use the Layer Transform submenu. One additional task that you can do with individual layers that’s a little bit more difficult to do with the whole image is rotate by an arbitrary value. To do this, select the layer that you want to rotate and go to Layer Transform Arbitrary Rotation. This actually activates GIMP’s Rotate tool and calls up a dialog like the one in Figure 8-12. 196 Chapter 8: Transforming Images FIGURE 8-11 Quickly drawing a symmetric gear using GIMP’s flip feature FIGURE 8-12 The Rotate dialog gives you direct control over how your layer is rotated. With this dialog, you can use the Angle slider to control the specific angle that you want to rotate your layer to. You can also use the Center X and Center Y values to control where the axis of rotation is. By default, GIMP places a center point indicating the axis of rotation at the abso- lute center of the layer. However, by adjusting these values or simply clicking the axis of rotation in the image window and dragging it to a new location, you can change the axis to another loca- tion. This is particularly useful if you need to rotate relative to another part of your image. The next section covers the Rotate tool as well as other transform tools in more detail. 197 Part III: Manipulating Images Tip Rotating all layers in your image by an arbitrary value takes only a couple more steps. Basically, before you do the rotation, you chain all layers together by going to the Layers dialog and Shift+clicking the space where the chain icon lives on any layer. When you use Shift+click, all layers are chained together. After that, rotate the layers by going to Layer Transform Arbitrary Rotation. Once you’ve completed your rotation, you may notice that the layers no longer fit the given image canvas. You can fix this quickly by using the Image Fit Canvas to Layers operation. Liquid Rescale: Quite Possibly the Coolest Thing Ever In August of 2007 a research paper entitled ‘‘Seam Carving for Content-Aware Image Resiz- ing’’ was published by Shai Avidan and Ariel Shamir. This paper and its accompanying video described a completely new way to change the size and scale of images while preserving the most important information in the image. You can watch the video yourself at www.youtube .com/watch?v=vIFCV2spKtg . Their research hit the graphics world like a ton of bricks and had legions of digital artists salivating in anticipation of getting such a feature in their tool of choice. A couple months later, the preliminary release of the Liquid Rescale plug-in was made. This kind of speedy development is one of the beautiful things about Free Software. Photoshop didn’t get the Content Aware Scaling feature until the release of Photoshop CS4, nearly a year later. To do anything in this section, you’re going to need to install the Liquid Rescale plug-in. If you don’t already have it installed, have a look at Chapter 21. To get an idea of some of the things Liquid Rescale is capable of, have a look at Figure 8-13. Using the same base image, the Liquid Rescale plug-in can adjust the image’s scale to fit all kinds of proportions, ranging from a CD sleeve to a wide panorama. It can even intelligently zoom in on the subject without horribly squashing or stretching any of the important elements. This is the power that Liquid Rescale has over conventional image scaling. FIGURE 8-13 Liquid Rescale can effectively resize your image without distorting it. (Photo credit: Melody Smith) Original image CD cover Smart zoom Panorama 198 Chapter 8: Transforming Images The released paper that Liquid Rescale is based on has all of the technical details about how it works. You can find it on the Liquid Rescale web site ( http://liquidrescale.wikidot.com) if you’re interested. The short explanation goes like this: conventional scaling algorithms don’t take into account the content of an image; a pixel is either enlarged or reduced and an interpolation algorithm is used to fill in or remove extra pixels. In contrast, the content-aware resizing algorithm that Liquid Rescale uses first analyzes the image in an attempt to determine the most visually relevant parts. These are the portions of the image that should be modified the least. Liquid Rescale uses this analysis to generate a seam map, which does the actual scaling using a technique called seam carving.Aseam in this case is either a horizontal or vertical string of pixels. The scaling algorithm creates a seam by using the seam map and connecting the pixels with the least important information in the image. From there, Liquid Rescale either removes the seam to scale the image down or adds a new seam with interpolated pixels to scale the image up. The cool thing is that horizontal and vertical seams work independently, so you can easily increase the width of your image while simultaneously decreasing its height. Using Liquid Rescale For the most part, using Liquid Rescale is a straightforward process. The first thing you need to know is that although the Liquid Rescale plug-in can be called only from the Layer menu, it actually does have an effect on the whole image. For instance, if your rescaled result is larger than your canvas size, Liquid Rescale increases the image’s canvas for you. However, if your result is less than the original image size, Liquid Rescale actually crops the other layers to fit the available space. In this way, it’s a bit like the Zealous Crop feature. For this reason, it’s a good idea to save backups of your image or, better yet, create a duplicate image (Ctrl+DorImage Duplicate) for doing your Liquid Rescale work. Once you’ve got your image all set up and ready to rock, it’s time to use the plug-in. Select the layer you want to rescale and then go to Layers Liquid Rescale. You should get a dialog like the one that appears in Figure 8-14. As with most scaling and sizing utilities, the real meat of the Liquid Rescale plug-in is the Width and Height fields on the left side of the dialog, beneath the preview image. Simply enter the width and height that you want to rescale the image to. Because one of the nice features of the seam carving algorithm is the ability to scale the vertical cleanly and independently of the hori- zontal, the chain link button next to the Width and Height fields is disabled by default. Note Although GIMP 2.8 allows you to use units, percentages, and expressions in numeric entry fields (for example, 8in, 50%, or 6cm+12px), that same feature isn’t automatically extended to entry fields in plug-ins. Hopefully this is something that will be fixed in the future, but in the meantime, know that numeric entry fields in plug-ins are only in the units shown in the drop-down menu. There are three buttons to the right side of the Width and Height fields. The topmost one resets the Width and Height values to the original values that were there when you first opened the Liquid Rescale plug-in. The next button down, with the floppy disk icon, allows you to recall width and height values from the last time you ran Liquid Rescale. This is handy if you’re using Liquid Rescale to make a set of images all the same size. The last button in this column has an icon with a set of gears. Click this button to activate Liquid Rescale’s interactive mode. The 199 [...]... 50 pixels away from the left side of the image The next leftmost object then starts 50 pixels from the cube’s left boundary, or 100 pixels from the left side of the image This continues on to the last object farthest away from the left side In this case, because that’s the fourth object, it’s 200 pixels (50 x 4) from the left side of the image Note It’s important to note here that the Alignment tool... defined increments, or steps This value indicates the location of the next seam step It is almost always outside of or at the very extent of the Range In the Map section, two other buttons besides the info button reveal the expanded information The button directly beneath the info button is the Map Reset button It shares the same icon as the button for resetting the width and height of your image; however,... starts with the same original 640 x 48 0 image as the one in Figure 8-22 Assuming you’re aligning relative to the image canvas, if you select all the elements in this image and click the Distribute Left button with an Offset value of zero, all the shapes end up flush against the left side of the image However, if you change the Offset to a value of 50 pixels, the leftmost object (in this case, the cube)... using the Brightness-Contrast tool After you create your presets, GIMP enables you to manage those presets by exporting them, importing them, or deleting them altogether For example, you may want to take your presets with you for using GIMP on other computers To access the preset management functionality, click the triangle icon to the right of the Add Preset plus sign This gives you a menu with the. .. cropping an image Using it is pretty simple: select the Crop tool and then click and drag a crop box in the image window over the area that you want to keep Like the Rectangle Select tool, the Crop tool can be resized Click and drag any of the boxes at the corners of the crop area to resize two sides at the same time Bringing your mouse near any of the edges of the crop area allows you to adjust just that... adjustments, the other sides of the crop box proportionally increase or decrease, maintaining the same aspect ratio You can also move around the entire crop area by clicking and dragging within it Once you’ve determined the portion of the image that you want to keep, press Enter or left-click within the crop area to perform the crop action By default, when you use the Crop tool, GIMP crops the entire... layers you have, whether they’re visible or not That’s the default behavior, but you can use the Tool Options for the Crop tool, shown in Figure 8- 24, to customize the Crop tool’s behavior FIGURE 8- 24 The Tool Options for the Crop tool give you additional flexibility when cropping The Crop tool’s Tool Options actually give you complete control over everything that it can do Each of these options is described... are available for download on the companion web site for this book (wiley.com/go/GIMPBible.com) That way if you don’t have a copy of GIMP immediately available, you can still see the results of these tools You can also find good color examples of these tools in the official GIMP documentation at http://docs .gimp. org 221 IN THIS CHAPTER Working with the features available in the Color menu Advanced color... Rescale (Layer Rescale) Liquid 2 Paint a feature preservation mask on the part of the image that you would like to zoom in on 3 Enable the Scale Back to the Original Size check box in the Output tab Set the scaling mode to Standard Scaling 4 Chain the Width and Height fields together by clicking the chain link icon to the right of them This ensures that your enhanced area is scaled proportionally If... can use to manage your settings The window gives you the same import and export functionality found in this menu, but you can also select specific settings to export or delete them altogether Figure 9 -4 shows the preset import/export menu and the Manage Saved Settings window FIGURE 9 -4 On the left is a color tool with the import/export menu visible and on the right is the Manage Saved Settings window . pixels. The scaling algorithm creates a seam by using the seam map and connecting the pixels with the least important information in the image. From there, Liquid Rescale either removes the seam. value indicates the location of the next seam step. It is almost always outside of or at the very extent of the Range. In the Map section, two other buttons besides the info button reveal the expanded. mask on the part of the image that you would like to zoom in on. 3. Enable the Scale Back to the Original Size check box in the Output tab. Set the scaling mode to Standard Scaling. 4. Chain the