You’ll use the Crop tool to trim and scale the photograph for this lesson so that it fits the space designed for it. You can use either the Crop tool or the Crop command to crop an image. Both methods permanently delete all the pixels outside the crop selection area.
- In the toolbox, select the Crop tool. Then, on the tool options bar (at the top of the work area), enter the dimensions (in inches) of the finished image: For Width type 2 in, and for Height type 3 in.
- Draw a crop marquee around the image. Don’t worry about whether the entire image is included, because you’ll adjust the marquee in a moment.
As you drag, the marquee retains the same proportion as the dimensions you specified for the target size (2 x 3 inches).
When you release the mouse button, a cropping shield covers the area outside the cropping selection, and the tool options bar displays choices about the cropping shield.
- On the tool options bar, make sure that the Perspective check box is not selected.
- In the image window, move the pointer outside the crop marquee so that it appears as a curved double arrow. Drag clockwise to rotate the marquee until it matches the angle of the picture.
- Place the pointer inside the crop marquee, and drag the marquee until it contains all the parts of the picture you want shown to produce an artistically pleasing result. If you need to adjust the size of the marquee, drag one of the corner handles.
- Press Enter (Windows) or Return (Mac OS). The image is now cropped, and the cropped image now fills the image window, straightened, sized, and cropped according to your specifications.
Note: You can use the Image > Trim command to discard a border area around the edge of the image, based on transparency or edge color.
- Choose File > Save to save your work.
The first step in retouching a photograph in Photoshop is to make sure that the image is the correct resolution. The term resolution refers to the number of small squares known as pixels that describe an image and establish its detail. Resolution is determined by pixel dimensions, or the number of pixels along the width and height of an image.
Pixels in a photographic image
In computer graphics, there are different types of resolution:
The number of pixels per unit of length in an image is called the image resolution, usually measured in pixels per inch (ppi). An image with a high resolution has more pixels (and therefore a larger file size) than an image of the same dimensions with a low resolution. Images in Photoshop can vary from high resolution (300 ppi or higher) to low resolution (72 ppi or 96 ppi).
The number of pixels per unit of length on a monitor is the monitor resolution, also usually measured in pixels per inch (ppi). Image pixels are translated directly into monitor pixels. In Photoshop, if the image resolution is higher than the monitor resolution, the image appears larger onscreen than its specified print dimensions. For example, when you display a 1-x-1-inch, 144-ppi image on a 72-ppi monitor, the image fills a 2-x-2-inch area of the screen.
Note: It is important to understand what “100% view” means when you work onscreen. At 100%, 1 image pixel = 1 monitor pixel. Unless the resolution of your image is exactly the same as the resolution of the monitor, the image size (in inches, for example) onscreen may be larger or smaller than the image size will be when printed.
The number of ink dots per inch (dpi) produced by a platesetter or laser printer is the printer, or output, resolution. Of course, higher-resolution printers combined with higher-resolution images generally produce the best quality. The appropriate resolution for a printed image is determined both by the printer resolution and by the screen frequency, or lines per inch (lpi), of the halftone screens used to reproduce images.
Keep in mind that the higher the image resolution, the larger the file size and the longer the file takes to download from the Web.
Note: To determine the image resolution for the photograph in this lesson, we followed the computer-graphics rule of thumb for color or grayscale images that are intended for print on large commercial printers: Scan at a resolution 1.5 to 2 times the screen frequency used by the printer. Because the magazine in which the image will be printed uses a screen frequency of 133 lpi, the image was scanned at 200 ppi (133 x 1.5).
For more information on resolution and image size, see Adobe Photoshop Help.
In this section we’ll apply a wave filter to the word Hello in our document. This entails the following steps:
- Set the document width and height to pixels and then rasterize the text object in the Text Layer.
Note: Because text is a vector graphic and a wave filter cannot be applied to vector graphics, we must first convert the image to a bitmap. Rasterizing converts mathematically defined vector artwork to pixels. For more information on rasterizing, refer to Adobe Photoshop CS2 Help.
- Select the area of the layer to which we want to apply the wave filter.
Note: See “Defining the area of a selection object” on page 54 in order to understand the code within the script that accomplishes this task.
- Apply a wave filter to the selection.
Note: The wave is a truncated sine curve.
Defining the area of a selection object
To define the area of a selection object, we will create an array of coordinates, or points specified in pixels within the document. The array indicates the coordinates that define the outside corners of a rectangular area that begins at the top left corner of the document and extends half way across the document.
Note: You can define any number of points for a selected area. The number of coordinates determines the shape of the selection. The last coordinate defined must be the same as the first so that the area.
The array values in order are:
- Upper left corner of the selection: 0,0
- 0 indicates the left-most column in the document.
- 0 indicates the top row in the document.
- Upper right corner of the selection: theDocWidthInPixels / 2, 0
- theDocWidthInPixels / 2 indicates the column in the middle of the document; that is, the column whose coordinate is the total number of columns in the document divided by 2.
Note
The value of theDocWidthInPixels is the total number of pixels that defines the document’s horizontal dimension. Columns are arranged horizontally.
- 0 indicates the top row in the document.
- Lower right corner: theDocWidthInPixels / 2, theDocHeightInPixels
- theDocWidthInPixels / 2 indicates the middle of the document.
- theDocHeightInPixels indicates the bottom row in the document; that is row whose coordinate is the total number of rows in the document.
Note
The value of theDocHeightInPixels is the total number of pixels that determine the vertical dimension of the document. Rows are stacked vertically.
- Lower left corner: theDocWidthInPixels / 2, 0
- theDocWidthInPixels / 2
- 0
- Upper left corner of the selection: 0,0
• To select an area and apply a wave filter to it:
- Type the following code into the script file HelloWorldDoc just above the commented statements that restore original preferences:
//create new variables to contain doc width and height
//convert inches to pixels by multiplying the number of
inches by
//the resolution (which equals number of pixels per inch)
docWidthInPixels = docWidthInInches * resolution
docHeightInPixels = docHeightInInches * resolution
//use the rasterize method of the artLayer class
newTextLayer.rasterize(RasterizeType.TEXTCONTENTS)
//create a variable to contain the coordinate values
//for the selection object
selRegion = Array(Array(0, 0),
Array(docWidthInPixels / 2, 0),
Array(docWidthInPixels / 2, docHeightInPixels),
Array(0, docHeightInPixels),
Array(0, 0))
//use the select method of the selection object
//to create an object and give it the selRegion values
//as coordinates
docRef.selection.select(selRegion)
//
newTextLayer.applyWave(1, 1, 100, 5, 10, 100, 100,
WaveType.SINE, UndefinedAreas.WRAPAROUND, 0)
- Save the script, and then open Adobe Photoshop CS2 and select the script from the Scripts menu (choose File > Script > HelloWorldDoc).
- After viewing the document in Adobe Photoshop CS2, close Adobe Photoshop CS2 without saving the document.
Note
Look up the following classes in the Adobe JavaScript Scripting Reference “Object Reference” chapter to see if you understand how you used them in this script:
- ArtLayer
- Rasterize() method. Notice that the RasterizeType.TEXTCONTENTS argument uses the RasterizeType constant. Constants are always depicted in uppercase letters in Adobe Photoshop CS2 JavaScripts.
- applyWave() method
In this section, we will add a layer to the HelloWorldDoc script, then change the layer to a text object that displays the text Hello, World! in red.
Before you begin, do the following:
- Quit Adobe Photoshop CS2.
- Open the script file HelloWorldDoc in your script editor application.
To create and specify details in a text item:
- Type the following code into the HelloWorldDoc script immediately before the commented statements that restore original preferences.
//create a reference to the active document
docRef = app.activeDocument
//create a variable named textColor
//create a SolidColor object whose color is red
//assign the object to textColor
textColor = new SolidColor
textColor.rgb.red = 255
textColor.rgb.green = 0
textColor.rgb.blue = 0
helloWorldText = "Hello, World!"
//create a variable named newTextLayer
//use the add() method of the artLayers class to create a
//layer object assign the object to newTextLayer
newTextLayer = docRef.artLayers.add()
//use the kind property of the artLayer class to make the
//layer a text layer
newTextLayer.kind = LayerKind.TEXT
newTextLayer.textItem.contents = helloWorldText
newTextLayer.textItem.position = Array(0.75, 1)
newTextLayer.textItem.size = 36
newTextLayer.textItem.color = textColor
- Save the script, and then open Adobe Photoshop CS2 and select the script from the Scripts menu (choose File > Script > HelloWorldDoc). Be patient while Adobe Photoshop CS2 executes your commands one by one.
- After viewing the document in Adobe Photoshop CS2, close Adobe Photoshop CS2 without saving the document.
The sample scripts in this section activate a Adobe Photoshop CS2 Application object and then save the default configuration settings into variables so that they can be restored later when the script completes. These are the default configurations you most probably set up in the Preferences dialog when you initially installed and configured Adobe Photoshop CS2.
Note: To view or set the Preferences on Mac OS, choose Photoshop >Preferences> Units & Rulers; in Windows choose Edit >Preferences> Units & Rulers.
To work with document preferences:
- Create the following script.
//create and assign variables for default preferences
startRulerUnits = app.preferences.rulerUnits
startTypeUnits = app.preferences.typeUnits
startDisplayDialogs = app.displayDialogs
//change settings
app.preferences.rulerUnits = Units.INCHES
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
//create and assign variables for document settings
docWidthInInches = 4
docHeightInInches = 2
resolution = 72
//use the length property of the documents object to
//find out if any documents are open
//if none are found, add a document
if (app.documents.length == 0)
app.documents.add(docWidthInInches,
docHeightInInches, resolution)
//restore beginning preferences
app.preferences.rulerunits = startRulerUnits
app.preferences.typeunits = startTypeUnits
app.displayDialogs = startDisplayDialogs
- Name the script HelloWorldDoc.jsx and save it in the Scripts folder.
- Open Adobe Photoshop CS2 and choose File > Scripts > HelloWorldDoc to run the script.
- Choose Edit > Preferences > Units & Rulers to verify that your preferences have been returned to your original settings.
- After viewing the document in Adobe Photoshop CS2, close the document without saving it.
- To prepare the script for the next section, comment the statements that restore the beginning preferences by adding slashes as follows:
//app.preferences.rulerunits = startRulerUnits
//app.preferences.typeunits = startTypeUnits
- Save the script.
When you create a complicated image that contains dozens of layers, your project can start hogging memory, which in turn makes it difficult to manage all the layers. Every time you create a new layer and add something to it, Photoshop gobbles up more memory. Photoshop not only has to think about what’s on that layer, but also has to remember what’s below the layer (even if that information is completely covered by the information on the layers above).
Note: Once you’ve merged two layers, it’s awfully hard to get them apart—the only way to do so is to use the History palette. However, even with the History palette, you might lose all the changes you’ve made since you merged the layers.
Whenever possible, I try to simplify my image by merging layers. This combines the layers into a single layer, and thus saves memory (because Photoshop no longer has to remember the parts of those layers that were previously being covered). The side menu on the Layers palette and the Layer menu itself give you several ways to do this:
- Merge Down: Merges the active layer into the layer directly below it.
- Merge Visible: Merges all the layers that are currently visible in the main image window.
- Merge Layers: Merges all the currently selected layers.
- Merge Group: Merges all the layers that are within the active group.
- Flatten Image: Merges all visible layers into the background, discards hidden layers, and fills empty areas with white.
If you want to know how much extra memory the layers take up as you’re modifying your image, choose Document Sizes from the menu that appears at the bottom center of the document. The number on the left should stay relatively constant (unless you scale or crop the image); it indicates how much memory your image would use if all the layers were merged together. The number on the right indicates how much memory the image is using with all the layers included. This number changes as you add and modify your layers. Keep an eye on it so that you can see how memory-intensive the different layers are.
Note: In Photoshop CS2 the memory usage indicator also appears at the bottom of the Info palette.
The number on the right might get huge if you’re using a lot of layers; however, keep in mind that you’ll know exactly how large the image will be when you flatten the layers by glancing at the left number.
Adobe added a new feature in Adobe Photoshop CS2 that allows you to easily align one layer with another. When you choose View > Show > Smart Guides, Photoshop will display pink guides to indicate how the active layer aligns with the surrounding layers. They pay attention to the top, bottom, left, right and center of each layer and extend the pink guides across all the layers that are aligned. The layers will also snap to these alignment points making it especially easy to get your layers in alignment. You can toggle the snapping behavior off or on by choosing View > Snap To > Layers.
The Smart Guides will ignore Layer Styles that are applied to a layer. In the example below, the outer ring of each object was created using the Stroke and Bevel & Emboss Layer Styles, so it was not used when determining where the edge of the layer is located. The Smart Guides will also ignore any areas that have an opacity of less than 50%, which will also affect any layers that have soft edges, causing the snapping behavior to treat the halfway point of the fadeout as the edge of the layer.
Have you ever had one of those mega-complicated images with dozens of layers? If so, you are probably familiar with the agony of having to fumble through an endless sea of layers, hoping you won’t drown before you find the right one. If this describes you, you’ll be ecstatic to know you can group a bunch of layers together. A group of layers looks like a folder in the Layers palette. You can view all the layers in the group or just the group name.
Note: The folders that are known as groups in Photoshop CS2 were called Layer Sets back in CS. They visually look the same, and most of the functionality is identical. The only real difference is that you can select multiple layers and Shift-click the folder icon to place those layers into a folder. In CS, you’d have to link the layers together and then choose New Set From Linked from the side menu of the Layers palette.
To group multiple layers, select the layers and then either Shift-click on the folder icon at the bottom of the Layers palette, or choose Layer > Group Layers. You can also click the folder icon (without holding any keys) to create an empty folder. Then, you can move any number of layers into the folder by dragging and dropping them onto the folder you just created. The folder will have a small arrow just to its left that allows you to collapse the group down to its name or expand the group to show you all the layers it contains. You can even drag one folder onto another to create a hierarchy of up to five levels of folders. This can greatly simplify the Layers palette, making a document of 100-plus layers look as if it’s made of only a few layers.
Note: To get rid of a group without throwing away the layers that are inside it, click on the group to make it active, click on the Trash icon at the bottom of the Layers palette, and then choose Group Only when prompted.
Option-clicking (Mac) or Alt-clicking (Windows) on the arrow next to a group will expand or collapse all the groups and Layer Style lists within that group. Adding the Command key (Mac) or Ctrl key (Windows) will expand or collapse all the groups in the entire document.
Groups can also be useful when you want to reorganize the layers in your image. If one of the layers within a group is active, then using the Move tool will affect only that layer (unless it’s linked to other layers). If the group is active, then using the Move tool will move all the layers within that group.
Adjustment Layers
The Adjustment Layer pop-up menu at the bottom of the Layers palette (it’s the half black and half white circle) allows you to apply adjustments that will affect multiple layers. This is the most versatile method for applying adjustments and it is such a powerful feature that I’ve devoted an entire chapter to it (Chapter 11 “Adjustment Layers”).
Fill Layers
The options in the Layer > New Fill Layer menu allow you to add solid color, gradient, and pattern content to a layer. This is especially useful when combined with Vector Mask, as described in Chapter 15, “Collage.” If you don’t want a fill layer to fill your entire document, then make a selection before creating one, which will create a layer mask. After a fill layer has been created, you can reset your foreground and background colors to black/white by pressing D. Then you can use the Eraser tool to hide the area and the Paintbrush tool to make areas visible again.
Solid Color Layer
Choosing Layer > New Fill Layer > Solid Color will bring up a dialog box that asks you to name the layer you’re creating. Once you click OK, it will open the color picker, where you can specify the color that will be used for the solid color layer. After you’ve created one of these layers, you can double-click the leftmost thumbnail of the layer in the Layers palette to edit the color.
Gradient Layer
Choosing Layer > New Fill Layer > Gradient will bring up a dialog box that asks you to name the layer; this will create a new layer that contains a gradient. The gradient is always editable by double-clicking the leftmost thumbnail in the Layers palette. If the Align with Layer check box is turned on, then the start and end points of the gradient are determined by the contents of the layer instead of the document’s overall size.
A bunch of really neat options are available under the Layer > Layer Style menu. You’ll find the same options under the Layer Style pop-up menu at the bottom of the Layers palette (it’s the leftmost icon). To experiment with these options, first create a new, empty layer, and paint on it with any of the painting tools. Then apply one of the effects found in the Layer > Layer Style menu: Drop Shadow, Inner Shadow, Inner Glow, Outer Glow, Bevel and Emboss, and so on. You can use the default settings for now. After applying an effect, use the Eraser tool to remove some of the paint on that layer. Did you notice that the layer effect updates to reflect the changes you make to the layer? Layer Styles create in one simple step the same results that would usually require multiple layers and a lot of memory.
Once you have at least one Layer Style applied to a layer, you’ll see a black circle with a small “f” inside it in the Layers palette. That’s the only indication that a layer has a Layer Style attached to it. You can click on the triangle that appears next to that symbol to see a list of the Layer Styles that are applied to that layer. If you drag one of the Layer Styles from that list and release your mouse button when it’s on top of another layer, you’ll move that Layer Style to the second layer. Holding Option (Mac) or Alt (Windows) when dragging a style will copy the style instead of moving it. Dragging the word “Effects” will move all of the Layer Styles that are attached to that layer. If you’d like to remove one of the Layer Styles, just click on its name in the list and drag it to the Trash icon at the bottom of the Layers palette.
You can even lower the Fill setting at the top of Photoshop’s Layers palette to reduce the opacity of the layer contents (or hold Shift and type a number while the Move tool is active) while keeping the Layer Style at full strength. Not only that, you can choose Layer > Layer Style > Create Layer to have Photoshop create the layers that would usually be needed to create the effect. For example, you might want to choose Create Layer if you want to distort the effect separately from the layer it was attached to. Let’s take a look at what a few of the Layer Styles do to your image.