Moiré

Downtown office towers packed together, each face a regular grid of windows, a few panes reflecting warm low sun.
Photo: Skyscrapers Downtown Toronto by Duncan Rawlinson. 200mm, f/8, 1/200, ISO 160. At 200mm each window here spans many pixels, so the grids record cleanly. Shot wider or from further away, the same grids shrink toward the spacing of the pixels, which is where moire begins.

Moire (moiré, or a moire pattern) is a false pattern of wavy bands, ripples or rainbow color that appears in a photo over fine, regular detail such as a woven shirt, a window screen, a distant fence or a TV screen. It matters because the bands are not in the scene: your camera invented them, they are hard to remove cleanly afterwards, and once you know what causes them a small change of distance, zoom or angle usually clears them in the camera.

The short version: a sensor records the world through a grid of pixels. When a pattern in the subject lands on that grid at almost the same spacing as the pixels, the two grids beat against each other and a third, much coarser pattern appears. Change the size or angle of the pattern on the sensor and the bands move, shrink or vanish.

What moire looks like, and what it is not

Moire has a few signatures that set it apart from other flaws:

  • Curved or wavy bands over straight detail. A pinstripe shirt shows sweeping arcs that follow the folds of the cloth, or a brick wall shows broad diagonal waves across rows of bricks that are really level.
  • Rainbow color that is not in the subject. A grey tweed jacket shows patches of magenta and green, or a black window screen picks up blue and orange swirls. This is color moire, also called false color.
  • Bands that shift when anything changes. Step half a pace, zoom a little or tilt the camera and the bands move, change spacing or disappear. Real detail does not do that.
  • Only on fine, repeating detail. Faces, skies and smooth surfaces in the same frame are clean.

Three things get mistaken for it. Noise is random speckle, not a pattern. Chromatic aberration is a colored fringe along high-contrast edges, strongest toward the corners of the frame, and comes from the lens rather than the sensor. Dark bars rolling across a photo of a screen or a room lit by LEDs come from flicker meeting the shutter, and they change with shutter speed, not with distance or angle.

There is also real moire, the kind your own eyes see: two layers of chain-link fence, a sheer curtain folded over itself, or a stack of window screens shimmer in person because two physical patterns overlap. Your camera records that faithfully, and no setting removes it. The rest of this page is about the moire your camera makes on its own.

Why a sensor makes moire: two grids beating

A sensor does not see a continuous image. Each pixel records one brightness value for its small patch of the frame, so the picture is sampled at fixed steps, one step per pixel (the image sensor page explains the photosites behind those pixels). That works perfectly for detail that changes slowly from pixel to pixel. It fails for detail that changes faster than the samples can follow.

The limit has a name, the Nyquist limit: to record a repeating pattern of dark and light, the sensor needs at least two pixels for each dark and light pair, one for the dark line and one for the light gap. Any pattern finer than that cannot be recorded as it is. It does not simply disappear either. It turns into a false, coarser pattern, which is what signal engineers call aliasing. Moire is aliasing you can see, because a regular subject makes the errors line up into bands.

Close: stripes 4 pixels apartPixels: recorded as stripesFurther: stripes 2.2 pixels apartPixels: bands every 11 pixels, strongFurther still: stripes 1.1 pixels apartPixels: bands every 11 pixels, faint
Each pair shows one stripe pattern as they land on the sensor (top strip) and the 44 pixels the camera records from them (bottom strip), each pixel averaging the light across its whole width. Close up, at 4 pixels per stripe, the file shows stripes. Further away, at 2.2 pixels per stripe, the stripes fade to flat grey and come back every 11 pixels: strong moire. Further still, at 1.1 pixels per stripe, the same 11 pixel bands appear but only faintly, because each pixel averages over almost a whole stripe and gap.

Read the diagram from the top. Close up, each stripe spans 4 pixels and the file records stripes. Step back until the stripes land 2.2 pixels apart, only just coarser than the 2 pixel Nyquist limit, and each pixel lands at a slightly different point in its stripe and gap than the pixel before. Some pixels catch mostly dark, some mostly light, and some an even mix that averages to grey, so the readings drift from full contrast to flat grey and back again, slowly, every 11 pixels. Those slow waves are moire: near the limit, even a pattern the sensor can in theory record comes out of the pixels as false bands, and just past it the pattern itself turns into a false one. It works like two guitar strings tuned slightly apart, which throb: the false band spacing is the stripe spacing divided by its difference from 2 pixels, so stripes 2.2 pixels apart give bands every 2.2 ÷ 0.2 = 11 pixels, and stripes 2.1 pixels apart give 2.1 ÷ 0.1 = 21 pixels. The rule works on the other side of the limit too: stripes 1.8 pixels apart give bands every 1.8 ÷ 0.2 = 9 pixels.

The bottom pair shows what happens further still. Stripes 1.1 pixels apart beat against the pixel grid itself, and the same rule works with 1 pixel in place of 2: 1.1 ÷ 0.1 = 11 pixels. But each pixel now averages over almost a whole stripe and gap, so the bands are real but faint. That is why moire is strongest for patterns a little either side of the Nyquist limit and fades as the pattern gets much finer, until the lens blurs it away entirely.

Two things follow from that rule, and both are useful on location:

  • The closer the stripe spacing is to the 2 pixel limit, the wider the false bands. That is why moire often shows as a few big, slow waves across a whole jacket rather than as fine texture.
  • A tiny change in the pattern’s size on the sensor makes a big change in the bands. In the example, going from stripes 2.2 to 2.1 pixels apart, a change of under 5 percent, nearly doubles the band spacing from 11 to 21 pixels. Real fabric and real lenses are messier than a perfect stripe, so treat these numbers as an illustration rather than a rule to measure by, but the pattern holds: a small change in size makes a large change in the bands. That is why a half step forward or a slight zoom so often clears it.

Why moire is so often colored

Most cameras put a mosaic of red, green and blue filters over the pixels, the Bayer pattern. In it, half the pixels are green, in a checkerboard, and only a quarter are red and a quarter blue. Red pixels sit on every second pixel of every second row, so the nearest red pixels are two pixels apart both across and down, and the same is true of blue. Each of those channels samples the scene on a grid twice as coarse as the full sensor, so it hits its own Nyquist limit at a pattern twice as coarse, around 4 pixels per stripe. A fabric weave can be fine enough to alias in red and blue while green still records it correctly, and each channel aliases in its own way. When the camera rebuilds full color from the mosaic, a step called demosaicing, those mismatched errors come out as swirls of color that were never in the scene.

The color filters over a sensor (Bayer pattern)RGRGRGRGGBGBGBGBRGRGRGRGGBGBGBGB2 pixels2 pixelsG: half the pixels,a checkerboardR and B: a quartereach, on every secondpixel of everysecond row
Each square is one pixel, labelled with the color of the filter over it. Green covers half the pixels in a checkerboard. Red (dark) and blue (light) each cover a quarter, and the nearest pixels of the same color are 2 pixels apart across and 2 pixels apart down, so red and blue each sample the scene on a grid half as fine as the sensor.

This is why color moire can appear on detail that is not quite fine enough to make the grey, wavy kind, and why sensors that record every color at every location (for example cameras that use pixel shift on a still subject, moving the sensor so each point is read through red, green and blue filters) show far less false color.

Wondering exactly how the camera turns a mosaic of single-color pixels into a full-color picture? Demosaicing walks through it, and why it guesses wrong on fine patterns.

When a pattern is small enough to cause trouble

Moire is not about the subject. It is about how big the subject’s pattern is on the sensor, and that depends on three things you control: how far away you stand, the focal length, and how many pixels the sensor has across its width.

Stand close to a striped shirt or a chain-link fence and each stripe or diamond spans many pixels, and the camera records it exactly. Step back and the same pattern shrinks on the sensor until each stripe is only a few pixels across. That is where the trouble starts, as the stripe diagram above showed for one pattern at three distances.

To put numbers on it, take a shirt with one stripe every millimetre, shot with a 50mm lens on a full-frame sensor 6,000 pixels wide (a pixel pitch of 6 micrometres, since 36 mm ÷ 6,000 = 0.006 mm). The stripe spacing on the sensor is the stripe spacing on the shirt times the magnification, and the magnification of a 50mm lens at distance d is about 50 ÷ (d − 50) in millimetres. Solving for the distance where the stripes land 4, 2 and 1 pixels apart gives:

1 mm stripes land on the sensor 50mm, 6,000 px wide 85mm, 6,000 px wide 50mm, 8,192 px wide
4 pixels apart 2.1 m 3.6 m 2.9 m
2 pixels apart 4.2 m 7.2 m 5.7 m
1 pixel apart 8.4 m 14 m 11 m

Read it as a danger zone, not as exact lines. Closer than the first row, which is the red and blue channels’ own limit, the stripes are recorded as stripes. Beyond it, color moire becomes possible. Around the second row, the Nyquist limit of the full grid, grey moire too, and this is where it is usually strongest and most obvious. Toward the third row the bands can grow wide but fade, because each pixel averages over nearly a whole stripe and gap, and further still the lens and any filter blur the stripes so much that there is little contrast left to alias. Notice what moves the zone: a longer lens pushes it further away (the 85mm column), and so do more pixels (the 8,192 pixel column, about 45 megapixels). More resolution does not cure moire. It moves the problem to finer detail and greater distances. A real shirt is also not a perfect grating, so read the table for where the risk starts, not as a promise. With the 50mm on 6,000 pixels, the same 1 mm stripes framed head and shoulders at 2 m sit outside the danger zone, while a full-length frame from about 4 m puts them right at the Nyquist row.

To find how many pixels wide your own sensor is, and so where its rows fall, the megapixel to resolution calculator converts a megapixel count into pixel dimensions.

Subjects that trigger moire

  • Fabric. Fine pinstripes, herringbone, houndstooth, tweed, silk ties and tightly woven shirts, especially in full-length and group portraits where the cloth is small in the frame.
  • Buildings. Window grids on distant towers, brick and tile, louvred vents, roof shingles, railings and mesh screens on facades, common in architecture and real estate work.
  • Screens. Monitors, phones, TVs and LED walls are themselves pixel grids, so photographing one sets two grids against each other almost by design.
  • Mesh and fences. Window and insect screens, speaker grilles, chain-link and wire fences at a distance.
  • Printed matter and fine natural detail. Halftone dots in magazines and newspapers, fine text, feathers, and fine hair.

How cameras fight moire

Since the cause is detail finer than the pixels can sample, every defense works by softening that detail a little before it reaches the pixels:

  • The anti-aliasing filter. Many sensors sit behind an anti-aliasing filter (optical low-pass filter), a thin layer that splits each point of light into a few slightly offset copies, a blur of about a pixel. It removes most moire at the cost of a little crispness, which sharpening mostly restores. Some high-resolution sensors leave it out to gain fine detail, and accept more moire risk.
  • The lens. A lens that is not quite sharp, or focus that is not quite on the pattern, acts as its own filter. Moire is worst with the sharpest lenses at their sweet spot, focused exactly on the fabric.
  • Diffraction. At small apertures, diffraction spreads every point of light into a disc. At f/11 that disc is about 15 micrometres across (2.44 × 0.00055 mm × 11), roughly two and a half pixels of 6 micrometres, enough to soften detail near the Nyquist limit. It softens everything else too.
  • More pixels. Higher resolution moves the Nyquist limit to finer detail, so a given pattern has to be further away or smaller before it aliases.
  • Video oversampling. A camera that makes video by skipping rows and columns of pixels samples coarsely and is prone to moire; one that reads the whole sensor and scales down to the video size filters the detail first and shows much less.

Weighing a camera with no anti-aliasing filter, or wondering how much sharpness the filter really costs? The anti-aliasing filter page covers the trade-off.

Stopping moire while you shoot

The fixes all change the size or angle of the pattern on the sensor, or soften it slightly. Try them roughly in this order, cheapest first:

  1. Move closer or further away. A half step changes the pattern’s spacing on the sensor by a few percent. As the stripe diagram shows, that can change the bands a lot, and moving closer can take the pattern out of the danger zone altogether.
  2. Zoom a little. Changing focal length scales the pattern the same way moving does, without moving your feet. Either direction shifts the bands, often enough to clear them. To take the pattern out of the danger zone altogether, zoom longer: that makes it bigger on the sensor, back to more than 4 pixels per stripe. Zooming wider makes it smaller and pushes it toward the faint, finely aliased end, which helps only if it was already near the 1 pixel row.
  3. Change the angle. Tilting or rotating the camera a few degrees changes how the pattern’s lines cross the pixel rows, which often breaks up the bands.
  4. Soften focus on the pattern. If the patterned area is not your subject, focusing a touch in front of or behind it, or using a wider aperture so it falls outside the depth of field, blurs it below the danger point at no cost to the subject.
  5. Stop down moderately. f/8 to f/11 on a full-frame sensor adds a little diffraction softening. Going to f/16 or f/22 usually costs more sharpness than it saves.

Check by zooming the rear screen to 100 percent on the patterned area. The fit-to-screen preview is too small to show moire reliably, and it can even show false moire of its own from being scaled down.

Not sure where sharpness starts to fall away as you stop down on your camera? Diffraction in photography works out the aperture for your sensor’s pixel size.

Removing moire afterwards

  • Shoot raw when you expect patterns. A raw file holds the mosaic before demosaicing, so the raw processor can choose how to demosaic and has more to work with. Moire reduction still works on a JPEG, but the camera has already baked its demosaicing guesses into the pixels, so there is less room to correct them.
  • Use a local moire brush, not a global slider. Raw processors offer a moire reduction adjustment that you paint over the affected area. It mostly removes false color by desaturating and smoothing color in that area, and leaves brightness detail alone. A local mask keeps the rest of the frame untouched.
  • Expect color moire to go and grey moire to stay. The color part is easy to remove because the real fabric has little color variation there. The grey waves are recorded as real brightness differences, and removing them means blurring the pattern itself or retouching it by hand.
  • For stubborn color, paint it out. In a layer-based editor, a layer set to the Color blend mode, painted with the true color of the cloth over the affected area, replaces the false hues and keeps the brightness detail.
  • Watch your resizing. Shrinking a photo for the web is sampling again, at a coarser grid, and can create moire on a file that was clean at full size. Use your editor’s standard resizing, which filters fine detail first, and apply output sharpening after resizing rather than before.

Common mistakes with moire

  • Judging the frame from the small preview. Moire often hides at fit-to-screen size, and the preview can also show moire that is not in the file. Zoom to 100 percent (see pixel peeping for when that habit helps and when it does not) on the patterned area before you leave.
  • Blaming the lens. Rainbow swirls on a jacket are not chromatic aberration. A sharper lens makes moire more likely, not less.
  • Reaching for f/22 first. It may blunt the pattern, but it softens the whole frame. A small change of distance, zoom or angle costs nothing.
  • Assuming more megapixels fix it. They move moire to finer detail and greater distances, which the table shows: the 8,192 pixel sensor reaches the Nyquist row for 1 mm stripes at 5.7 m instead of 4.2 m. Some pattern, at some distance, will still land near the pixel spacing.
  • Fixing the whole image for a local problem. A global moire or noise slider softens color everywhere. Paint the correction on the affected area only.
  • Checking once. Every time you zoom or someone steps closer, the pattern’s size on the sensor changes, and a clean pattern can start to ripple.

Try this: make moire, then make it go away

You need a fine regular pattern and ten minutes. A computer monitor showing a white page, an insect screen with daylight behind it, or a finely striped shirt on a hanger all work.

  1. Put the camera or phone on a steady surface, focus on the pattern, and set a middle aperture such as f/5.6.
  2. Start close, then step back a pace at a time, taking a frame at each step. Phones work too, but do not use the zoom button to reframe, because some phones switch lenses.
  3. Zoom each frame to 100 percent. Find the first distance where bands or color appear. That is the edge of your camera’s danger zone for that pattern.
  4. At that distance, take three more frames: one a half step closer, one with the camera rotated about 5 degrees, and one with focus pulled slightly off the pattern.

Judge the result by the band spacing. If the half step changed the bands from wide to narrow or made them vanish, you have seen the beat rule at work. If the rotated frame is clean, the angle broke the line-up of the two grids. If the slightly defocused frame is clean while still showing the pattern as a soft texture, you have done by hand what an anti-aliasing filter does.

Want to test the whole chain from sensor to file, demosaicing included? The raw processing quiz checks what you know about what happens between the pixels and the picture.

Frequently asked questions about moire

Is moire the same as aliasing?

Moire is one visible kind of aliasing. Aliasing is any false detail created when a sensor samples detail finer than its pixels; it becomes moire when the subject is regular enough for the errors to line up into bands. Jagged stair-steps on fine diagonal lines are another kind.

Do phones get moire?

Yes, especially on screens, fabric and building grids. Phone processing often smooths fine detail and suppresses false color, which hides much of it, but the sampling problem is the same on any sensor with a pixel grid.

Why do I see moire in my editor but not in the exported file?

Your editor shows a scaled-down version of the image at fit-to-screen size, and that scaling can create moire of its own. Zoom to 100 percent: if the bands disappear there, they are in the preview, not the photo.

Does a camera without an anti-aliasing filter always show moire?

No. It only appears when a regular pattern lands near the pixel spacing, which most subjects never do. On landscapes and most portraits a camera without the filter simply records slightly crisper detail; on fabric, screens and building grids it needs more care.

How do I photograph a computer screen without moire?

Step a little closer or further away, or zoom in or out slightly, since either changes the size of the screen’s pixel grid on your sensor, and try tilting the camera a few degrees. Focusing a touch off the screen surface softens its pixel grid, and a screenshot is always better than a photograph when you only need what is on the screen.

Can film get moire?

Film grain is random, not a grid, so film does not create sampling moire in the camera. Moire can still appear when a film image is scanned, because the scanner is a sensor with a pixel grid.