Sub topic 10
Using Grids to Crop Photos and Lay Out Designs
This chapter assumes you know how the thirds grid is built (two vertical lines, two horizontal lines, four intersections) and how to place a subject and a horizon on it. Here the grid becomes a working tool for two jobs: cropping an existing photo and arranging elements in a design.
Cropping with a grid
Cropping removes parts of an image to change what the frame contains. A crop changes three things at once: the subject's size relative to the frame, the position of the subject within the frame, and the aspect ratio. A grid helps with the second one, but you must keep an eye on all three.
When you crop, the grid is redrawn on the new frame. A subject that sat on a thirds line in the original photo can end up off the line after the crop. Every crop therefore starts over: pick the new frame, then check where the subject falls on the new grid.
A cropping workflow
- Identify the subject or focal point in the original. If there are several candidates, decide which one the picture is about.
- Choose the target aspect ratio first (for example 4:5 for a social post, 16:9 for a slide, 1:1 for an avatar). Lock it in the crop tool.
- Turn on the thirds overlay in the crop tool.
- Drag the crop box until the subject sits on a line or intersection. For a portrait, put the nearer eye on the upper horizontal line or on an upper intersection.
- Check the horizon, if there is one, against the upper or lower horizontal line. Rotate the crop slightly if the horizon is tilted.
- Check lead room. If the subject faces or moves in a direction, leave more frame on that side.
- Check the edges for distractions such as a bright patch, a cut-off limb, or a stray object, and nudge the box to remove them.
Crop limits
A crop can only choose from pixels you already have. Three limits come up often:
- Resolution. A tight crop of a small area discards pixels. A 6000 by 4000 photo cropped to a 1500 by 1000 region keeps only one sixteenth of the pixel count. That is fine for a web image but poor for a large print.
- Missing room. If the subject touches the edge of the original, you cannot create lead room by cropping. You can only gain space by extending the canvas or filling it in with editing tools, which is a different technique.
- Lens and perspective. Cropping does not change perspective. A wide-angle distortion near the corners stays visible if you keep the corners in the crop.
The code below computes the largest crop of a given aspect ratio that puts a chosen subject point on the nearest thirds intersection. It is a small model of what the crop tool does, and it shows why some crops are impossible.
def crop_for_intersection(img_w, img_h, subject, aspect, corner="upper-left"):
"""Return (x, y, w, h) of the largest crop with the given aspect ratio
(width / height) that places `subject` on one thirds intersection.
Returns None if no such crop fits inside the image."""
sx, sy = subject
fx = 1 / 3 if "left" in corner else 2 / 3
fy = 1 / 3 if "upper" in corner else 2 / 3
# Largest width allowed by the image bounds.
# Crop left edge = sx - fx*w must be >= 0 and right edge <= img_w.
max_w_x = min(sx / fx, (img_w - sx) / (1 - fx))
# Same for height, then convert to a width through the aspect ratio.
max_h_y = min(sy / fy, (img_h - sy) / (1 - fy))
w = min(max_w_x, max_h_y * aspect)
if w <= 0:
return None
h = w / aspect
return (sx - fx * w, sy - fy * h, w, h)
# A 6000 x 4000 photo, subject at (2400, 1500), 3:2 crop,
# subject on the upper-left intersection.
print(crop_for_intersection(6000, 4000, (2400, 1500), 3 / 2))
# (0.0, 0.0, 7200.0, 4800.0) -> wait: larger than the image?The last line shows a bug in the naive version, so look at the result before trusting it. The width limit from the image bounds is not enough, because the crop must also not exceed the image size itself. Here is the corrected function.
def crop_for_intersection(img_w, img_h, subject, aspect, corner="upper-left"):
sx, sy = subject
fx = 1 / 3 if "left" in corner else 2 / 3
fy = 1 / 3 if "upper" in corner else 2 / 3
max_w_x = min(sx / fx, (img_w - sx) / (1 - fx), img_w)
max_h_y = min(sy / fy, (img_h - sy) / (1 - fy), img_h)
w = min(max_w_x, max_h_y * aspect)
if w <= 0:
return None
h = w / aspect
return (sx - fx * w, sy - fy * h, w, h)
x, y, w, h = crop_for_intersection(6000, 4000, (2400, 1500), 3 / 2)
print(round(x), round(y), round(w), round(h))
# 0 0 4350 2900The subject at (2400, 1500) cannot reach the upper-left intersection of a full-size crop. The bounds force a crop of 4350 by 2900, which keeps about 54 percent of the pixels. Where the answer is small, the subject is too close to an edge or too far into the image for that intersection, and another intersection may work better.
Laying out designs with a grid
In layout, the thirds grid divides a page, slide, poster, or banner into nine zones. You use it to decide where each element goes, not just where the photo's subject goes.
Assigning roles to zones
A common approach gives each major element its own zone or line:
- The most important element (a headline, product, or face) sits on an intersection or fills a zone beside it.
- A supporting element (a subtitle, a logo, a call-to-action button) takes another zone and aligns with a line.
- Empty zones stay empty. White space is part of the design, and the grid shows you how much you have.
On a 1920 by 1080 slide, the vertical thirds lines sit at x = 640 and x = 1280. A text block aligned to x = 640 with a product image filling the right two thirds gives a clear one-third text, two-thirds image split.
Text over photos
A photo with its subject on a right-hand line leaves the left third calm. That calm region is where overlay text fits best, because it has low detail and the text stays readable. Work in this order:
- Crop the photo so the subject sits on a line or intersection.
- Find the zones that remain empty and low in contrast.
- Put the headline in one of those zones, aligned to a grid line.
- Check contrast. If the text is hard to read, add a subtle darkening layer or move the text, not the subject.
Grid overlays in CSS
You can show the grid directly on a web page while you work, using the overlay from the topic's CSS example. The version below adds a toggle class so you can turn it on and off without removing markup.
.photo {
position: relative;
}
.thirds-overlay {
position: absolute;
inset: 0;
display: none;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
pointer-events: none;
}
.show-grid .thirds-overlay {
display: grid;
}
.thirds-overlay > div {
border: 1px solid rgba(255, 255, 255, 0.6);
}Add the show-grid class to the .photo element to see the nine cells. Because pointer-events: none is set, the overlay does not block clicks on the image.
For a real layout, the same idea works with content. A three-column CSS grid with a text column and a two-column image area reproduces the one-third and two-thirds split:
.slide {
display: grid;
grid-template-columns: 1fr 2fr;
gap: 0;
width: 1920px;
height: 1080px;
}Choosing between grids for a task
The thirds grid is the default, but other grids fit some jobs better. The choice depends on what the picture or page needs to do.
| Task | Grid to try | Reason |
|---|---|---|
| Portrait with one clear subject | Thirds | Eye on the upper line or intersection gives balance and space for the face |
| Symmetric building or reflection | Halves (center) | The subject is built around the center line |
| Multi-item layout with many aligned parts | Quarters or a column grid | More lines mean more alignment points |
| Strong movement across the frame | Diagonals | Subjects follow the line of motion |
| Fine adjustment of proportions | Golden-ratio grid | Lines sit at about 38.2 and 61.8 percent, nearer the center than thirds |
You can compare the thirds and golden-ratio line positions on any frame with the earlier functions. For a 1920 by 1080 frame, the thirds lines fall at x = 640 and 1280, and the golden lines fall at x = 733 and 1187. The difference is about 93 pixels on each side, which is visible but small. In practice, either grid gives a good result if you apply it with care, and the choice matters less than checking your subject against the lead room and the edges.
Common errors
- Cropping first, choosing the ratio later. Changing the aspect ratio afterward moves every line and breaks the placement you made. Set the ratio first.
- Snapping to a line without checking the subject. A face on an intersection still looks wrong if the eyes are cut off by the frame edge.
- Putting the subject on the line but no lead room. A subject on the right line facing right still looks cramped. Lead room beats exact line placement.
- Tilted horizon. A horizon on the correct line but rotated a few degrees looks like an error. Straighten first, then crop.
- Cropping too tight for the output. Check the final pixel dimensions against the size you need.
- Treating the grid as a law. The grid is a check, not a goal. If a crop looks right but the subject sits slightly off a line, keep it.
Summary of the method
Choose the output ratio, overlay the grid, place the subject and horizon, leave lead room, then check edges and resolution. For layout, give each element a zone, align text to grid lines, and leave some zones empty on purpose.
Exercise
A 4000 by 3000 photo has a subject centered at (1000, 1000). You need a 1:1 crop that puts the subject on the upper-left thirds intersection. Using the bounds in the chapter's function, what is the largest crop size, and where is its top-left corner?
Show answer
The upper-left intersection is at 1/3 across and 1/3 down. Width limits: subject x / (1/3) = 3000, (4000 - 1000) / (2/3) = 4500, and the image width 4000, so the smallest is 3000. Height limits: 1000 / (1/3) = 3000, (3000 - 1000) / (2/3) = 3000, and the image height 3000, so the smallest is 3000. For a 1:1 ratio the crop is 3000 by 3000. The top-left corner is at x = 1000 - 3000/3 = 0 and y = 1000 - 3000/3 = 0, so the crop is (0, 0, 3000, 3000).
Exercise
You are laying out a 1920 by 1080 banner with a headline and a product photo. Describe a thirds-based layout, giving the x positions of the lines you align to, and explain why the headline should not sit over the product's busiest area.
Show answer
The vertical thirds lines are at x = 640 and x = 1280. Put the headline in the left third (x from 0 to 640, aligned to a left margin or to the line at x = 640) and let the product photo fill the right two thirds, with the product on or near the x = 1280 line. The headline should avoid the busiest area of the photo because detail and contrast there reduce text legibility and compete with the focal point.