Sub topic 7
Principles of Cropping
This chapter assumes you know the img element and its attributes, basic CSS sizing, and how breakpoints work in a responsive layout. It covers the decisions behind a crop. The CSS and picture techniques that apply a crop come in later chapters.
What a crop does
A crop removes part of an image. You keep a rectangle and discard the rest. A crop does three things:
- It changes the aspect ratio, the proportion of width to height, such as 16:9 or 1:1.
- It changes the emphasis. The subject takes up more of the frame, and distractions leave it.
- It changes the resolution you have to work with. Fewer pixels remain, so a tight crop of a small photo can look soft.
Every crop is a trade. You gain focus and a fitting shape, and you lose pixels and context. Decide what you want before you cut.
Start from the container, not the photo
Designers often crop a photo "to look good" and then fit it into a layout. This tends to break later. A better order is:
- Find the shape of the slot the layout gives the image (for example, a 16:9 hero or a square card thumbnail).
- Find the subject in the photo.
- Choose the largest rectangle with the slot's aspect ratio that contains the subject with room around it.
Step 3 has a useful side effect. The largest rectangle keeps the most pixels, so you protect resolution as well as composition.
You can work out the crop size with simple arithmetic. For a source image that is W × H pixels and a target ratio r (width divided by height):
- If W / H is greater than r, the photo is too wide. Keep the full height and set the crop width to H × r.
- If W / H is less than r, the photo is too tall. Keep the full width and set the crop height to W / r.
def largest_crop(width: int, height: int, ratio: float) -> tuple[int, int]:
"""Return the largest (crop_width, crop_height) with the given ratio."""
if width / height > ratio:
return round(height * ratio), height
return width, round(width / ratio)
# A 4:3 photo (4000 x 3000) cropped to 16:9
print(largest_crop(4000, 3000, 16 / 9)) # (4000, 2250)
# The same photo cropped to a square
print(largest_crop(4000, 3000, 1)) # (3000, 3000)The 16:9 crop keeps 75% of the pixels (2250 of 3000 rows). The square keeps 75% as well (3000 of 4000 columns). A portrait crop at 9:16 would keep only 1688 × 3000, which is about 42% of the original pixels.
Cropping and the shape of the subject
Some subjects suit some ratios. Matching them reduces how much you cut away.
| Subject | Tends to fit | Why |
|---|---|---|
| Landscape, skyline, group of people in a row | 16:9, 3:1 | Information spreads horizontally |
| Single standing person, tall building | 3:4, 9:16 | Information stacks vertically |
| Face, product on a plain background, logo | 1:1 | Subject is compact and centered |
| Mixed or unknown | 4:3, 3:2 | Close to the shape of many cameras |
When the container and the subject disagree, such as a standing person in a wide banner, you have three options. You can accept an aggressive crop (for example, head and shoulders), choose a different photo, or change the layout. Do not stretch the image to fill the slot. Stretching distorts faces and objects, and it is a layout error, not a crop.
Where to cut
Crops fail in predictable ways. Check these before you accept one.
Do not cut at joints
Avoid edges that fall at a joint of the body: the neck, elbows, wrists, knees, and ankles. A frame edge at the knee reads as an amputation. Cut through the thigh, the shin, or the middle of the forearm instead. Hands matter in particular. If a hand is part of the story, such as the baker holding the loaf, keep it entirely inside the frame.
Keep a little head room and lead room
Leave some space above a person's head. A crop that touches the top of the head feels cramped. A crop that leaves a wide band of empty space makes the subject look small. A common target is roughly one eye-width to a head-height of space, depending on the photo.
For a subject facing or moving sideways, leave more space on the side they are facing. This is called lead room. A person looking right should sit left of center, with open space to the right.
Watch the edges for stray objects
Objects that are partly cut off at the edge pull the eye. A stranger's elbow, a lamp post, or half a cup at the border competes with the subject. Move the crop edge inward to remove the object, or outward to include all of it.
Avoid tangents
A tangent happens when an edge of the subject just touches another line, such as a head touching the horizon or a chin resting on the frame edge. It looks like an accident. Shift the crop a few percent so the shapes either clearly overlap or clearly separate.
Tight, medium, and wide
The same photo can serve different jobs at different tightness.
| Crop | What it shows | Typical use |
|---|---|---|
| Wide | Subject within its setting | Page headers, location context |
| Medium | Subject with some surroundings | Articles, team sections |
| Tight | Detail or face | Avatars, cards, product close-ups |
Tighter crops need more source pixels. If a card shows a face at 200 CSS pixels wide and the screen has a 2× pixel density, the face region needs at least 400 pixels across in the source. If the face occupies only a tenth of a 2000-pixel-wide photo, you have 200 pixels of face and the crop will look soft. Plan for this when you pick the photo.
Crop once, or crop per use?
You can crop a photo permanently in an editor, or you can leave the file whole and crop in the browser. Each approach has costs.
| Approach | Strengths | Weaknesses |
|---|---|---|
| Crop in an editor and export | Smaller files, full control, fits `picture` art direction | Loses the original framing; many exports to manage |
| Crop in the browser with CSS | One file, easy to adjust, works with changing layouts | Downloads pixels that are then hidden |
A practical rule: use CSS cropping for small adjustments to a similar ratio, and make separate exports when the ratios differ a lot, such as a 16:9 desktop hero and a 1:1 phone hero. Always keep the uncropped original so you can recrop later.
Edge cases
- Unknown future ratios. If editors will upload photos, you cannot know the subject's position. Design the layout so a crop that keeps the center is acceptable, and give editors a way to set a focal point (the next chapters cover this).
- Faces near the edge. Group photos often put people at the border. A square crop of a wide group will cut someone off. Check each person, or use a wider ratio.
- Text inside the photo. Signs, labels, and packaging text are cut off in a crop and become unreadable. Keep text fully in or fully out.
- Re-cropping an already-cropped image. Each crop reduces pixels. Start from the original file, not from a previous export.
- Rotated or mirrored photos. Cameras store orientation in metadata. Some tools ignore it. Check that the crop is done on the photo as people see it.
- Mirroring a photo to fix lead room. This changes the real world. Writing, logos, and scars flip. Do not mirror photos of text or identifiable people.
A quick crop review
Before you accept a crop, ask:
- Is the subject recognizable at the smallest size it will be shown?
- Does the crop leave room around the subject, including lead room?
- Do any edges fall at joints, or cut through text and objects?
- Are there tangents, or stray fragments at the border?
- Are there enough pixels at the largest size and the highest pixel density?
Exercise
A source photo is 3000 × 2000 pixels. A banner slot is 3:1. What is the largest crop of the photo that fits the slot, and what share of the original pixels does it keep?
Show answer
The photo's ratio is 3000 / 2000 = 1.5, which is less than 3, so the photo is too tall for the slot. Keep the full width (3000) and set the height to 3000 / 3 = 1000. The crop is 3000 × 1000 pixels. It keeps 1000 / 2000 = 50% of the original pixels. If the subject does not fit in that 1000-pixel band, pick a different photo or a taller slot.
Exercise
A portrait of a person looking to the left is cropped so that the person sits in the center. The right edge of the frame passes through the person's elbow. Name two problems and say how you would fix them.
Show answer
The first problem is a cut at a joint (the elbow). Move the right edge inward to cut through the upper arm or outward to include the whole elbow and forearm. The second problem is missing lead room. The person looks left, so shift the crop so the person sits right of center, leaving open space on the left side. If the photo does not have enough room on the left, choose a different photo.