Sub topic 9
Cropping to a selection, trimming and changing canvas size
This chapter covers three menu-driven commands that change the boundaries of a document without the Crop tool: Image > Crop, Image > Trim and Image > Canvas Size. It assumes you can open and save images, find your way around the toolbar and options bar, and understand layers and pixel dimensions at a basic level. It also assumes you have read the earlier chapter on cropping versus resizing, so you know that cropping and canvas changes alter the area of the document, not the pixel density.
Where these commands fit
The Crop tool is interactive. You drag handles, see an overlay and commit with Enter. The three commands here are not interactive in that way. Each one reads a rule (a selection, the color of the edges, or numbers you type) and applies it in one step.
| Command | Rule it follows | Typical use |
|---|---|---|
| Image > Crop | The bounding box of the active selection | Fast crop when you already have a selection |
| Image > Trim | Pixels that match a color or transparency at the edges | Removing borders or empty margins |
| Image > Canvas Size | Numbers you enter and an anchor point | Adding or removing space around the image |
All three change the canvas, which is the rectangular working area of the document. None of them resamples pixels, so the image does not get blurrier or sharper.
Image > Crop (crop to a selection)
Image > Crop trims the document to the bounding box of whatever selection is active. The bounding box is the smallest upright rectangle that contains the whole selection.
- Make a selection with any tool: Rectangular Marquee, Lasso, Quick Selection, or Select Subject.
- Choose Image > Crop.
- The canvas shrinks to the selection's bounding box.
Key points:
- The selection does not need to be rectangular. With an oval or a freehand selection, Photoshop crops to the rectangle that encloses it. The pixels outside the selection but inside the rectangle stay.
- Image > Crop always deletes the pixels outside the box. It has no Delete Cropped Pixels option. If you need to keep them, duplicate the document first or use the Crop tool with Delete Cropped Pixels turned off.
- The command is unavailable (grayed out) when there is no selection.
- A feathered selection is measured by its visible edge, so the box may be slightly smaller than you expect. If the result looks too tight, remove the feather or expand the selection first with Select > Modify > Expand.
Cropping to an exact size with a marquee
You can use the Rectangular Marquee's Style option to get an exact pixel size.
- Choose the Rectangular Marquee tool.
- In the options bar, set Style to Fixed Size and enter Width and Height, for example
1200 pxand800 px. - Click once in the image to place the selection, then drag it into position with the arrow keys or the mouse. Hold Space while dragging to reposition it as you draw.
- Choose Image > Crop.
This is useful when the Crop tool's aspect ratio presets are not what you need, but the Crop tool's W x H x Resolution mode is usually quicker for the same job.
Cropping a multi-layer document
Image > Crop applies to every layer. Layers that extend outside the new canvas keep their hidden pixels only if they are not on the Background layer and the crop is applied in a way that preserves them. In practice, Image > Crop discards the pixels outside the box, so assume that layer content outside the canvas is gone. Smart Objects are an exception worth knowing: the Smart Object keeps its full source data internally, so you can still move it within the new canvas to bring hidden parts back into view.
Image > Trim
Image > Trim removes margins by looking at the image itself. It scans inward from the edges and removes rows and columns whose pixels match a chosen reference. It is the right tool for a screenshot with a white border, a product shot on a flat background, or a layer exported with extra transparent space.
Choose Image > Trim to open the dialog. It has two groups of settings.
Based On
- Transparent Pixels trims away fully transparent space around the visible content. This works best on a layered document where the background is hidden or absent. A Background layer has no transparency, so this option does nothing useful there.
- Top Left Pixel Color uses the color of the pixel at the top left corner as the reference and trims every edge row or column that matches it.
- Bottom Right Pixel Color does the same using the pixel at the bottom right corner.
Trim Away
Check any combination of Top, Bottom, Left and Right. By default all four are checked. Uncheck a side to leave it alone. For example, to remove only a white strip at the bottom of a scanned page, leave Bottom checked and uncheck the other three.
How Trim decides what to remove
Trim compares colors exactly. A pixel is removed only if it matches the reference color. This has two consequences you will notice quickly:
- JPEG artifacts, noise and subtle gradients at the edge mean pixels that look identical to your eye are not identical in value. Trim stops at the first pixel that differs, so it may remove little or nothing.
- Anti-aliased edges and soft shadows count as content. Trim will keep them.
If Trim does not do what you expect, the usual fix is to prepare the edge first. Fill the border with a flat color using the Paint Bucket, or select the border with the Magic Wand using a suitable Tolerance, fill it, then run Trim.
Worked example: trimming a transparent margin
Suppose you have a logo on a transparent layer inside a 3000 x 3000 px document, and the logo only occupies the middle 800 x 600 px.
- Select the logo layer and hide any Background layer so the checkerboard shows at the edges.
- Choose Image > Trim.
- Select Transparent Pixels and leave all four Trim Away boxes checked.
- Click OK.
The canvas becomes 800 x 600 px, exactly the extent of the visible logo. If the document had a soft drop shadow with faint alpha, the canvas would include the shadow's faint pixels, which can leave a margin larger than you wanted.
Trim versus Reveal All
Image > Reveal All is the mirror of this idea. When a layer extends beyond the canvas (for example after you moved or placed something large), Reveal All expands the canvas to show every layer in full. Trim shrinks to content; Reveal All grows to content. They are useful as a pair when you want to normalize a document's size to its artwork.
Image > Canvas Size
Canvas Size changes the dimensions of the document area without scaling the pixels that are already there. Choose Image > Canvas Size (Alt+Ctrl+C on Windows, Option+Command+C on macOS).
The dialog has these parts:
- Current Size shows the existing width, height and file size.
- New Size is where you type the width and height. The units can be pixels, inches, centimeters, millimeters, points, picas, columns or percent.
- Relative makes the numbers you type mean "add this much" (positive) or "remove this much" (negative), instead of the final size.
- Anchor is a 3 x 3 grid. The square you click marks the part of the image that stays fixed. The canvas grows or shrinks away from it.
- Canvas extension color decides what fills new space: Foreground, Background, White, Black, Gray, Other, or transparent on a layer-based document with no Background layer.
How the anchor works
The anchor tells Photoshop where the existing image sits in the new canvas.
- Centered anchor: space is added or removed equally on all sides.
- Top-left anchor: the image stays in the top-left corner. New space appears on the right and bottom, and cropping removes pixels from the right and bottom.
- Bottom-center anchor: useful for adding sky above a subject, because new space appears on the top, left and right.
Making the canvas smaller crops
If the new size is smaller than the current size, Photoshop warns that some clipping will occur and asks to proceed. Choosing Proceed discards pixels outside the new boundaries, in the same way as Image > Crop. So Canvas Size is also a crop with numeric input and an anchor.
Worked example: adding a border
To add a 50 px border on every side of an image:
- Open Image > Canvas Size.
- Check Relative.
- Enter
100for Width and100for Height. The value is 100 because 50 px is added on the left and 50 px on the right. - Keep the Anchor centered.
- Set Canvas extension color to White and click OK.
If the image was 1600 x 1000 px, the result is 1700 x 1100 px.
Worked example: making a square canvas
To turn a 1600 x 1000 px landscape image into a 1600 x 1600 px square with extra space at the bottom:
- Open Image > Canvas Size and uncheck Relative.
- Set Width to
1600and Height to1600pixels. Make sure the link between them is not constraining the values (Canvas Size has no proportion lock, so you can type both). - Click the top-center anchor.
- Choose a Canvas extension color and click OK.
The original image stays at the top, and 600 px of new space appears at the bottom.
Canvas Size and layers
- On a document with a Background layer, new space is filled with the extension color.
- On a document with no Background layer (all regular layers), new space is transparent, and the extension color setting is disabled or ignored.
- Existing layers keep their positions relative to the anchor. Layer masks and artboards are not resized to fill the new area, so a mask on a full-canvas layer will not cover the new space.
Canvas Size versus Image Size
A common mistake is using Image Size when you wanted Canvas Size. Image Size scales the pixels, so the picture gets bigger or smaller. Canvas Size leaves the pixels as they are and changes the frame. If a document gets blurry after you resize it, you probably used the wrong command or left Resample on when you should not have.
Common errors and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Image > Crop is grayed out | No active selection | Make a selection first |
| Trim removes nothing | Edge pixels differ slightly in color, or the document has a Background layer and you chose Transparent Pixels | Fill the border with a flat color, or pick a corner color option |
| Trim removes too much | The reference corner pixel is the same color as part of the subject | Pick the other corner, or uncheck some Trim Away sides |
| Canvas grows in the wrong direction | Wrong anchor square | Undo and choose the correct anchor |
| Added space is transparent when you wanted white | There is no Background layer | Add a solid fill layer below, or convert a layer to Background |
| Result is smaller than the selection | Selection was feathered | Remove the feather or expand the selection before cropping |
Choosing between them
Rules of thumb:
- Use Image > Crop when the shape of the subject defines the frame.
- Use Trim when the content defines the frame and the margins are uniform.
- Use Canvas Size when you know the numbers, when you are adding space, or when you need to pin the image to one edge.
- Use the Crop tool with Delete Cropped Pixels off when you need to keep your options open.
Exercises
Exercise
You have a 2400 x 1600 px photo and want a 2500 x 1700 px canvas with the extra 100 px on each axis added only on the right and at the bottom, filled with white. Which Canvas Size settings do you use?
Show answer
Open Image > Canvas Size, check Relative, enter Width 100 and Height 100, click the top-left anchor so the image stays in the top-left corner, set Canvas extension color to White, and click OK. The result is 2500 x 1700 px with the new space on the right and bottom.
Exercise
A product photo on a flat white background still has a thin white margin after you run Image > Trim with Top Left Pixel Color, even though the margin looks pure white. Give one likely cause and one fix.
Show answer
The margin pixels are not exactly the same value as the top-left pixel, for example because of JPEG compression noise, so Trim treats them as content. Fix it by selecting the margin with the Magic Wand at a suitable Tolerance, filling it with a flat white, and then running Trim again.
Exercise
You select an oval around a face and choose Image > Crop. What shape is the resulting document, and what happens to the pixels at the corners of that shape?
Show answer
The document is a rectangle equal to the oval's bounding box. The pixels in the corners, which lie outside the oval but inside the box, are kept. Only pixels outside the bounding box are discarded.