Why transform random noise into Fourier space?

Tree-Ring Watermarks (Wen, Kirchenbauer, Geiping and Goldstein, NeurIPS 2023) watermarks images from a diffusion model without ever touching the image. Instead, it hides a secret key in the random noise the model starts from. To check an image later, you run the model backwards, recover that starting noise, and look for the key.

The key is not written into the noise directly. It is written into the noise’s Fourier transform, as a set of rings. This post is about that one decision. By the end you will have attacked the watermark yourself, and seen why the rings survive edits that wipe out a classic watermark.

Why watermark generated images?

Diffusion models make images that are hard to tell from photos. That makes fake “evidence”, misinformation and copyright misuse cheap. A watermark lets the company that runs a model check later whether an image came from it.

A useful watermark has to be:

  • invisible, so it doesn’t spoil the image,
  • free, so image quality doesn’t drop,
  • robust, so it survives the edits images go through online: screenshots, crops, compression, filters.

The classic approach is post-hoc: generate the image, then hide a few bits in its pixels. A common example is DwtDct, the method early Stable Diffusion releases used to mark their outputs. Here is where it puts the watermark, following the invisible-watermark library:

  1. Convert the image to YUV and use only the two colour channels, U and V. Brightness (Y) is left alone, because the eye is more sensitive to it.
  2. Apply a one-level wavelet transform (the “DWT”) and keep its approximation band: a half-size, slightly smoothed copy of the channel.
  3. Cut that copy into 4×4 blocks and take each block’s discrete cosine transform (the “DCT”), the same kind of transform JPEG uses.
  4. In each block, take the strongest non-constant coefficient and round it into a slot: coefficients are measured in steps of 36, and the bit decides whether the value lands in the lower or upper half of its step.

A 512×512 image has 8,192 such blocks, so each of the 32 bits is written into 256 of them. The changes are invisible, and reading the same blocks back recovers the bits by majority vote.

So DwtDct is a frequency-domain watermark too. The difference is in which frequencies: they are local, measured separately in each 4×4 block on a fixed grid, and the bit is stored in the exact size of one coefficient.

Both of those are weak spots. The decoder has to find each block at exactly the right position: rotate the image by a degree or crop a few pixels, and the grid no longer lines up. And it has to read each coefficient precisely enough to tell which half of its step it is in: blur, JPEG or a brightness change shift the coefficient by more than a quarter step (9 units), and the bit flips. In the paper’s benchmark, DwtDct’s average AUC under attacks drops to 0.574, barely better than a coin flip (0.5). You will break it yourself further down.

The Tree-Ring idea

Tree-Ring uses a property of samplers like DDIM: they are deterministic. The same starting noise always produces the same image, and the process can be approximately run in reverse (DDIM inversion) to get from an image back to its noise.

So instead of marking the image, Tree-Ring marks the noise:

  1. Sample the starting noise xT, as usual.
  2. Take its Fourier transform and write a ring-shaped key into a small circle at the centre.
  3. Transform back. This is the watermarked starting noise.
  4. Generate the image normally. The model is not changed at all.

To detect: invert the image back to its noise (with an empty prompt, since you don’t know the original one), take the Fourier transform, and check whether the circle still matches the key.

That leaves the question this post is about: why do steps 2 and 3 go through Fourier space?

A two-minute Fourier refresher

The Fourier transform describes an image as a sum of waves. Here a wave just means a striped brightness pattern: light and dark bands that blend smoothly into each other and repeat. Each wave has four settings: how many stripes (frequency), which way they run (direction), how strong they are (contrast), and where the bands sit (phase).

The important part: the transform does not extract waves from the photo. The set of stripe patterns is fixed in advance, one for every possible frequency and direction. The transform only measures how much of each fixed pattern the photo contains. It multiplies the photo by a pattern pixel by pixel and adds everything up: a big number means the photo looks like those stripes, a number near zero means it doesn’t.

Put every measurement on a grid and you get the Fourier map:

  • the centre holds the slow, wide stripes (low frequencies): overall brightness and large shapes,
  • the outer region holds the fast, thin stripes (high frequencies): edges, texture, noise,
  • the direction from the centre is the direction of the stripes.

Photos are mostly smooth shapes, so their maps are bright in the centre and dark outside. Try it on the image below, a teddy bear in front of Baku’s Flame Towers that I generated with Gemini 3.1 (Nano Banana 2). Being AI-generated, it already carries Google’s invisible SynthID watermark, one of the systems in the last section; everything in this post goes on top of it. Rotate the image and watch the map, then keep only the centre, then remove it.

Interactive figure: needs JavaScript.

Three things to notice, because the rest of the post depends on them:

  1. Rotating the image rotates its map by the same angle.
  2. Keeping only the centre gives a blurry but recognisable image. The low frequencies carry the structure.
  3. Removing the centre leaves only edges and texture, the part that blur and compression destroy first.

Writing the key

The starting noise in Stable Diffusion is a 4×64×64 array of Gaussian random numbers: four channels, each a 64×64 grid. Tree-Ring picks one channel (the paper’s experiments use the last one), takes its Fourier transform 𝓕(xT), picks a circle M of radius r around the centre, and replaces the values inside it with a key k*:

$$ \mathcal{F}(x_T)_i \sim \begin{cases} k^*_i & \text{if } i \in M \\[2pt] \mathcal{N}(0, 1) & \text{otherwise} \end{cases} $$

The paper tries three keys:

  • Zeros: every value in the circle set to zero.
  • Rand: the Fourier transform of a separate random noise sample, so the new values have the same statistics as the ones they replace.
  • Rings: concentric rings of width one, each ring holding a single value (a complex number taken from the Fourier transform of a random noise sample). This is the “tree ring” in the name, and the paper’s main method.

Here are all four steps on real numbers. The blue dashed circle is M.

Interactive figure: needs JavaScript.

Panels 1 and 4 look like the same kind of static, and that is the point. The Fourier transform of Gaussian noise is itself Gaussian noise, so replacing a small patch of it with Gaussian-like values (Rand, Rings) leaves something the model can’t tell apart from ordinary noise. Zeros is the exception: it removes energy, which is why it costs the most image quality in the paper (FID 26.6, against 25.5 for Rand and 25.9 for Rings).

With Rings selected, look closely at panel 4 and you may spot faint circular ripples. That is not a bug. A pattern that is round in Fourier space is also round in pixel space: each ring of constant value becomes a ripple spreading out from the corner pixel (the transform’s origin, so it wraps around to all four corners), with a weaker echo in the middle of the grid. It is small, about a quarter of the noise’s spread, so it mostly hides in the noise. Rand has no such structure, because its values are random.

Attack it yourself

Now the main experiment. Pick an attack and drag its strength. The same attack hits both watermarks. To keep things simple, the lab applies one attack at a time, as the paper’s benchmark does; images shared online often go through several edits in a row, and their errors add up. What you see:

  • Tree-Ring (left): the attacked noise, its Fourier map, and a close-up of the circle (the key, what was recovered, and the difference). Underneath are the detection distance and p-value.
  • DwtDct (right): the attacked image with 32 hidden bits, and which of them still read back correctly. Each bit is stored in 256 blocks and read back by majority vote; the bar under each bit shows how many blocks still vote for the right value. The votes erode gradually, but the majority flips late and suddenly, so the bit count tends to jump from 32 straight down to about half.

The “paper” button jumps to the strength used in the paper’s benchmark. For brightness the paper draws a random factor for each image, so the button does too.

Interactive figure: needs JavaScript.

One honesty note: a browser can’t run Stable Diffusion, so the Tree-Ring side is a simulation. It applies each attack straight to the watermarked noise, as if DDIM inversion recovered the noise perfectly. JPEG, blur and pixel noise are applied at 8× resolution, the way Stable Diffusion’s latent relates to its pixels. Crop & scale copies the official code’s 3:4 crop. Rotation is modelled as an exact rotation of the Fourier map, and brightness as a scaling of the noise: these are the Fourier properties the paper relies on, and which it found survive inversion in practice. The DwtDct side is the real algorithm running on a real generated image, with the real attacks.

What each attack does in Fourier space, and why the rings survive it:

AttackWhat happens to the Fourier mapTree-Ring keyDwtDct bits
Rotationrotates by the same anglerings look the same at every angleblocks misaligned, bits lost
JPEGouter region (fine detail) thrown awaysits in the centre, mostly survivessurvives mild compression, then fails
Crop & scalezooms in, so the map squeezes toward the centresurvives mild crops; at 25%, ring values slide onto smaller ringsblocks misaligned, even for small crops
Blurouter region fadescentre barely touchedsurvives slight blur, then coefficients shift out of their slots
Noisesmall error added everywheresmall error per valuesurvives light noise
Brightnessevery value is multiplied by the same factorrings keep their shape; the p-value accounts for the scalevalues move out of their slots

Crop & scale is the one attack where this simulation is harsher than the paper. The official code cuts out a 3:4 rectangle with 75% of the area (75% of the width, the full height) and stretches it back to a square. That squeezes the Fourier map sideways to 75% of its width, so a value that sat on ring 10 is now compared with ring 7 or 8. Here the rings hold up to about a 15% crop and then fail. The paper, which goes through the real image, VAE and DDIM inversion, reports an AUC of 0.961 for Rings at that strength, so treat this row as a limit of the simulation rather than of Tree-Ring. DwtDct is worse either way: a crop of a few pixels already shifts every block.

Why rings, and not just “Fourier space”?

Set the attack to Rotation, switch the key from Rings to Rand, and drag the slider. Both keys live in the same Fourier space, at the same place, but only one survives.

Rotation rotates the Fourier map, so a random pattern inside the circle rotates with it, and every value ends up in the wrong place. A ring has the same value all the way around, so rotating it changes nothing. The paper measures exactly this: under rotation, Rand drops to an AUC of 0.486 (worse than guessing), while Rings stays above 0.93.

So Fourier space doesn’t make a watermark robust by itself. It makes the effect of common edits predictable: rotation is a rotation, blur and JPEG eat the outside, brightness moves one value. That predictability lets you design a key the edits can’t touch. Concentric rings at low frequencies are that design.

What if an edit wrecks the low frequencies too?

A natural question at this point: what if you edit the image so heavily that even the low frequencies change? Then the rings are gone, but so is most of the image. The low frequencies carry its overall layout and large shapes, which is what the image shows. An edit that scrambles them (extreme blur, heavy noise, a nearly black image) leaves nothing worth tracing. That is the bargain Tree-Ring makes: the watermark lives in the same place as the content, so you can’t remove one without ruining the other.

Two caveats keep this honest. First, the benchmark edits are not subtle: a 75° rotation, JPEG at quality 25 and a 25% crop are all clearly visible. The target is edits that change how an image looks but keep what it shows. Second, some of those edits do change the low frequencies, a lot. Rotation turns them and cropping squeezes them, yet the image looks fine. That is why the shape of the key matters as much as its location: Rand sits in the same low frequencies and still dies under rotation.

And this argument covers everyday edits, not determined attackers. Someone who wants the watermark gone can rebuild the noise without visibly changing the image, which the last section comes back to.

How detection decides

To check an image, Tree-Ring inverts it to recover the noise x′T and measures how far its Fourier values inside the circle are from the key:

$$ d = \frac{1}{|M|} \sum_{i \in M} \left| k^*_i - \mathcal{F}(x'_T)_i \right| $$

A raw distance needs a threshold that has no obvious meaning, so the paper also turns it into a p-value. If the image is not watermarked, the recovered noise is ordinary Gaussian noise, and the (squared, normalised) distance to the key follows a known distribution, a noncentral χ². The p-value is the chance that an unwatermarked image would match the key this closely by luck. Flag the image when p is below, say, 0.01, and you know you will wrongly accuse about 1 in 100 clean images. That is the p-value shown in the attack lab. In the paper’s examples, a clean image gives p ≈ 0.3, a watermarked one p ≈ 10−60, and even a heavily attacked one p ≈ 10−16.

Limits

  • Only the model owner can check. Detection needs the model (for inversion) and the secret key.
  • It needs a deterministic, invertible sampler like DDIM.
  • The simulation above is generous to Tree-Ring. Real DDIM inversion is approximate, so real recovered rings are noisier than here, although the paper’s numbers show they still hold up: an average AUC of 0.975 under attacks, against 0.574 for DwtDct.
  • Robust is not the same as secure. Tree-Ring survives everyday edits, but a determined attacker can remove or even forge it (next section).

What came after

Tree-Ring is from 2023, which is a long time ago in this field. Its core move, hiding the watermark in the starting noise and checking by inversion, became a whole family of methods. That family also became a target.

Better keys. RingID (2024) keeps the Fourier rings but spreads keys over several channels, so a provider can tell which key, and therefore which user, made an image. Gaussian Shading (CVPR 2024) drops the fixed pattern: it encodes bits into the noise so that it stays exactly Gaussian, with no quality cost. PRC watermarks (2024) go further and use pseudorandom codes, so that without the key, watermarked noise is provably indistinguishable from ordinary noise.

Attacks. The same inversion trick that makes detection possible also helps attackers. Müller et al. (2024) showed that with any similar public model you can invert a watermarked image, then either strip the key or stamp it onto an unrelated image, forging the watermark. Later work does this from a single watermarked image, against Tree-Ring, RingID and Gaussian Shading alike, and A Crack in the Bark (2025) removes Tree-Ring using only the model’s public VAE. A fixed ring pattern that sits far from typical noise is exactly what makes this easy.

Avoiding inversion. Inverting a diffusion model takes as long as generating with it, which is expensive at scale. Recent methods such as GROW (CVPR 2026) guide the generation towards a watermark target instead, so detection doesn’t need inversion.

What is deployed. In practice, large providers use learned pixel watermarks rather than Tree-Ring: Google’s SynthID has marked over ten billion images and video frames, and Meta open-sourced Video Seal. These are often paired with C2PA content credentials, signed metadata that records where an image came from.

None of this makes Tree-Ring’s main lesson outdated. Every method above still has to answer the question this post started with: in which space do common edits act predictably, so that a signal written there survives them?


This post is based on my presentation of the paper for the course “Generative Vision: The Art and Science of Visual Synthesis” at Johns Hopkins University.

References