1. An X-ray apparatus comprising: an X-ray irradiating device for irradiating a subject with X-rays; an X-ray detector for detecting X-rays transmitting through the subject; an imaging-condition setting section for setting X-ray imaging conditions for applying X-rays from the X-ray irradiating device; a mask-image taking time calculating section for (i) setting a first imaging time, in a first mask image, in accordance with the X-ray imaging conditions, and (ii) calculating a second imaging time, in mask images from the second, for a mask image to be taken next in accordance with the imaging time and brightness of the mask image taken previously such that average brightness of the mask image taken previously and the mask image to be taken next is target brightness; a live-image taking time calculating section for calculating an imaging time for a live image in accordance with the imaging time for the mask image to which X-rays are applied from the X-ray irradiating device in accordance with the first or the second imaging time; and an image processor for inputting detection signals detected by the X-ray detector and calculating a subtraction image by difference between a reference mask image and the live image, the reference mask image being obtained through averaging two or more mask images taken in accordance with the first or the second imaging time.