1. A method for generating at least one X-ray image of a patient with incorporated contrast medium, using X-ray radiation generated at an anode and including an energy spectrum of bremsstrahlung and characteristic radiation, and an X-ray detector, the method comprising: modifying the energy spectrum by using at least one first filter, arranged in a beam path in front of the patient; generating detector data for the X-ray image upon the patient absorbing a dose of X-ray radiation, the X-ray image including a CNR value which represents a ratio of a maximum contrast in the image to noise; and adjusting the energy spectrum and the contrast medium to one another by using an additional filter, taking account of a thickness of the patient to be X-rayed such that an optimization criterion taken from an experimentally generated or simulated X-ray image, is maximized.