Digital images may be impaired by periodic or quasiperiodic noise, which manifests itself by spurious long-range repetitive patterns. Most of the time, quasiperiodic noise is well localized in the Fourier domain; thus it can be attenuated by smoothing out the image spectrum with a well-designed notch filter. While existing algorithms require hand-tuned filter design or parameter setting, this paper presents an automated approach based on the expected power spectrum of a natural image. The resulting algorithm enables not only the elimination of simple periodic noise whose influence on the image spectrum is limited to a few Fourier coefficients, but also of quasiperiodic structured noise with a much more complex contribution to the spectrum. Various examples illustrate the efficiency of the proposed algorithm. A comparison with morphological component analysis, a blind source separation algorithm, is also provided. A MATLAB® implementation is available.