The invention relates to a method for producing an x-ray image (1) of an object (2) by means of an x-ray device (3). An x-ray source (4) and an x-ray detector (5) are moved about an object (2) during an at least partial circulation (8, 9), and the x-ray beams (10) which are generated by the x-ray source (4) and pass through the object (2) are detected from multiple different directions by means of the x-ray detector (5). In the process, at least one optical camera (13, 14) captures the object (2) during the circulation, wherein an optical image (15, 17) is produced. The optical camera (13, 14) has a rigidly defined position relative to the x-ray source (4) and/or the x-ray detector (5). The optical image (15, 17) is then used to determine a movement trajectory of the object (2) relative to the x-ray source (4) and/or the x-ray detector (5).